Only if I try to access the API from Angular FE, I get the error.Īny ideas what could be the cause and how to fix it?Īlso, I think that it's not caused by not being authorized to use the application, because as I said it works outside the Angular and also if user is not authorized, it's configured to return 403 instead of 401. The strangest about it is that if I try to access the API directly by calling the request in browser or in Insomnia with NTLM Authorization, everything works just fine. Options.AddPolicy(name: MyAllowSpecificOrigins,īuilder => `, this.httpOptions) 1 Answer Sorted by: 3 A preflight request to check for CORS headers is only done if the request done with XHR could not be achieved without XHR. Startup.cs public void ConfigureServices(IServiceCollection services) Out of frustration I have even allowed all origins, headers and methods, when I was trying to debug this issue. I'm getting CORS error with description PreflightMissingAllowOriginHeader followed by 401 error.īelow you can see my code. The preflight gives the server a chance to examine what the actual request will look like before it’s made. It contains information like which HTTP method is used, as well as if any custom HTTP headers are present. with but arent addheader Access-Control-Allow-Headers DNT,User-Agent. Anyway the issue persists even after reverting all the Authentication configuration so it may not be related. A preflight request is a small request that is sent by the browser before the actual request. Nginx configuration enables CORS, with support for preflight requests. NET Core 3.1 + Angular and everything was working fine until recently, when I was trying to implement Negotiate Authentication configuration to the backend.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |