In my API, I have the following code:
public class CustomOAuthProvider : OAuthAuthorizationServerProvider
{
public override Task MatchEndpoint(OAuthMatchEndpointContext context)
{
if (context.OwinContext.Request.Method == "OPTIONS" && context.IsTokenEndpoint)
{
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Methods", new[] { "POST" });
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Headers",
new[] {
"access-control-allow-origin",
"accept",
"x-api-applicationid",
"content-type",
"authorization"
});
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
context.OwinContext.Response.StatusCode = (int)HttpStatusCode.OK;
context.RequestCompleted();
return Task.FromResult<object>(null);
}
return base.MatchEndpoint(context);
}
}
When I connect to this API from Chrome, everything works fine. When I connect from the same computer to the same API, but only from another Internet Explorer 11 browser, I get the following error:
SEC7123: The request header x-api-applicationid was not present in the Access-Control-Allow-Headers List.
I debugged the code and I see that the headers are being added to the response. Even IE shows headers:

What expects IE?
Update
If I reordered the headers from
new[] {
"access-control-allow-origin",
"accept",
"x-api-applicationid",
"content-type",
"authorization"
}
at
new[] {
"content-type",
"accept",
"access-control-allow-origin",
"x-api-applicationid",
"authorization"
}
The error message changes to:
SEC7123: The request header access-control-allow-origin was not in the Access-Control-Allow-Headers List.
Thus, it always throws an error in the third header.