I'm getting the following error in Chrome:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIISPlatformHandler();
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseCors(policy => policy
.WithOrigins("http://localhost:9000")
.AllowAnyMethod()
.WithHeaders("Access-Control-Allow-Origin, Content-Type, x-xsrf-token, Authorization")
.AllowCredentials());
app.UseMvc();
}
According to chrome there is not a single header being added to the response.
What is the correct way to add the access-control-allow-origin
header to a options response in Asp.NET 5?