I have an ASP.NET 5 Web API (well, anyway, MVC) that I consume using axios in my JS application.
My CORS configuration in MVC is as follows:
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseCors(builder => { builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader(); }); }
In other words, I must allow any request. However, although these fixed pre-flight request requests, POST requests are still rejected (I see that it is running on the server, but there is no header in the response, which leads to an error on the client side).
Does anyone have any ideas why this won't work?
These are the headers returned by the MVC api:
- For the preposition OPTIONS (this run):

- For the actual POST request (this one fails):

cors asp.net-core
valorl
source share