The 'Access-Control-Allow-Origin' header contains multiple values , but only one is allowed
The 'Access-Control-Allow-Origin' header contains multiple values , but only one is allowed
I got the above error when i call .net core api from backbone js
Here is my code
in start up.cs:
services.AddCors(options =>
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
);
in Configure i do the following:-
app.UseCors("CorsPolicy");
app.UseStaticFiles();
ConfigureAuth(app);
app.UseMvc();
Thanks in advance
I think when you use
.AllowCredentials()
, you need to specify domains, can't use .AllowAnyOrigin()
. I'm removing backbone because it doesn't have anything to do with the problem, it's a backend issue– T J
Sep 1 at 13:21
.AllowCredentials()
.AllowAnyOrigin()
i fixed the issue. remove header from iis http response headers
– isree
Oct 16 at 13:50
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
i try to removing ALL code that enabled CORS and then added the cors settings to the system.webServer node of my Web.Config but issue still exists
– isree
Aug 30 at 12:17