Reputation: 79
Edit: Realized my mistake. "Access-Control-Allow-Request-Headers" should be "Access-Control-Allow-Headers"
I am trying to use a get api with a header, but I keep getting Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.
I am using angular2 and calling a webapi using asp.net on an iis10 server
I edited my IIS10 already, and I edited the web.config... What else can I do?
Upvotes: 0
Views: 431
Reputation: 13704
The error message talks about a header named Access-Control-Allow-Headers
while you set the Access-Control-Allow-Request-Headers
in the config file.
I'd also suggest considering moving the CORS configuration in the Web API config as it's a matter related to your application.
Upvotes: 1
Reputation: 79
*sigh.. "Access-Control-Allow-Request-Headers" should really be
"Access-Control-Allow-Headers"
Upvotes: 0