-
Notifications
You must be signed in to change notification settings - Fork 10.4k
CORS header not being set for internal server error response #22281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After seeing the Code fix done as part of Issue #2378. I feel like the fix is not considered for latest code. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I know this seems insignificant, but this is a thorn in my side when helping newer developers debug. Every 500, 404, 401/403 etc. is reported by the browser as a CORS error. A lot of time is wasted chasing these red herrings when the real issue has nothing to do with CORS. |
hey, I've been struggling with the same issue and following solution seems to have worked:
I have made an answer on StackOverflow https://stackoverflow.com/a/71695813/1215913 There is also an explanation provided by another author why the solution works. Happy coding :) |
I had the same issue. As a workaround, I added a new middleware that act as a global exception handler: var app = builder.Build();
app.Use(async (context, next) =>
{
try
{
await next(context);
}
catch (Exception e)
{
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
await context.Response.WriteAsync(e.ToString());
}
});
app.UseCors(); |
We spent hours and hours trying to figure out what's wrong with internal server response. First we thought it's our proxy cutting the response but no, it's dotnet. Hope for the best. |
For internal server error, there are no access-control-* headers in the response. As far as I know
this issue should be fixed since ASP.NET Core 2.2.
Here is my CORS configuration:
And in
Configure
method :Further technical details
The text was updated successfully, but these errors were encountered: