-
Notifications
You must be signed in to change notification settings - Fork 10.3k
CORS with endpoint routing and RequireCors does not support automatic preflight requests #20709
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
Hello, I believe there is still a real issue here that should not be closed as By design. Allow me to explain.
As such, it seems with my 4 hours of attempting combinations and reading the newly updated documentation in regards to CORS, that the only way to achieve this is to enable application wide CORS support. This probably isn't ideal, as the documentation states, it would be much more secure to be able to target specific controllers with specific CORS policies as needed. As it stands I have had to go with a global policy, but I would prefer to not have to do this, by having either of the other two options work with Authorization middleware without workarounds. Solved When using Endpoint Routing CORS and IdentityServer4, the call to UseCors() must be after UseRouting() but BEFORE UseIdentityServer() and UseAuthorization(). Otherwise it will appear to work but Pre-Flight checks will fail |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
https://cors3.azurewebsites.net/ try the PUT button and see my source in the article |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue. This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue! |
This was first reported in #18665
See Enable Cors with endpoint routing which explains it and has deployed code to reproduce the behavior. Given this is documented you may want to close this issue by design and I'll update the docs to say *By Design.
cc @pranavkm @apacurariu
The text was updated successfully, but these errors were encountered: