Request header was not present in the Access-Control-Allow-Headers list

后端 未结 3 763
借酒劲吻你
借酒劲吻你 2021-01-18 00:05

In my API, I have the following code:

public class CustomOAuthProvider : OAuthAuthorizationServerProvider
{

    public override Task MatchEndpoint(OAuthMatc         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-18 00:52

    No need to remove MatchEndPoint

    Instead of adding array element just add Comma-Separated value as first array element in Access-Control-Allow-Headers

    Instead of

     context.OwinContext.Response.Headers.Add("Access-Control-Allow-Headers", 
                    new[] { 
                        "access-control-allow-origin", 
                        "accept", 
                        "x-api-applicationid", 
                        "content-type", 
                        "authorization" 
                    });
    

    use

    context.OwinContext.Response.Headers.Add("Access-Control-Allow-Headers", 
        new[] { 
            "access-control-allow-origin,accept,x-api-applicationid,content-type,authorization" 
        });
    

提交回复
热议问题