Aurelia HttpClientを使用して、別のドメインのTagniFi APIを呼び出して認証しようとしています。関連するコードは次のとおりです。認証付きAurelia HttpClient
return this._httpClient.createRequest(uri)
.asGet()
.withCredentials(true)
.withHeader('Access-Control-Allow-Origin', 'localhost:9000')
.withHeader('Authorization', 'Basic <my-key>')
.send();
私はAPIからステータス200を受け取るんが、私は次のエラーを取得:これは私は方法に誤りがある場合
Response to preflight request doesn't pass access control check: A >wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header >when the credentials flag is true. Origin ' http://localhost:9000 ' is >therefore not allowed access. The credentials mode of an XMLHttpRequest >is controlled by the withCredentials attribute.
私はわからないがAureliaに電話またはバグを起こす。どんな助けもありがとうございます。ありがとう。
ありがとうバレンタイン、私はあなたの応答をありがとう。したがって、正しく理解していれば、私が呼び出す宛先サーバーがAccess-Control-Allow-Originヘッダーを返すように構成されていないという問題があります。言い換えれば、これは私のコードのバグではありませんが、サーバーの設定のエラーですか?コード内でエラーが発生した場合は、修正案があるかどうかお知らせください。ありがとう。 – sevenshadow