Description
Hi maintainers,
At the Preflight requests section, I think there is an incorrect expectation when it mentions that if the preflight request is denied, it return a 200 OK status code without CORS headers.
|
If the preflight request is denied, the app returns a `200 OK` response but doesn't set the CORS headers. Therefore, the browser doesn't attempt the cross-origin request. For an example of a denied preflight request, see the [Test CORS](#testc6) section of this document. |
It should be returning 204 No Content instead. I've provided a screenshot that calls the OPTIONS endpoint with invalid origin and highlighted the status code. Can you guys help to confirm this behavior?
Additionally, here is my simple setup in case you need a quick repro.
Thank you!
Page URL
https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-10.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/cors.md
Document ID
d3f332c4-4c60-039e-0e1e-bc6b11831f87
Platform Id
fa70aa3f-a2de-be8b-4255-e778a6edb8ff
Article author
@tdykstra
Metadata
- ID: 59bca5db-1196-2a8b-a0d8-4e89b2382288
- PlatformId: fa70aa3f-a2de-be8b-4255-e778a6edb8ff
- Service: aspnet-core
- Sub-service: security
Related Issues
Associated WorkItem - 550679
Description
Hi maintainers,
At the Preflight requests section, I think there is an incorrect expectation when it mentions that if the preflight request is denied, it return a
200 OKstatus code without CORS headers.AspNetCore.Docs/aspnetcore/security/cors.md
Line 366 in fde96be
It should be returning
204 No Contentinstead. I've provided a screenshot that calls the OPTIONS endpoint with invalid origin and highlighted the status code. Can you guys help to confirm this behavior?Additionally, here is my simple setup in case you need a quick repro.
Thank you!
Page URL
https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-10.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/cors.md
Document ID
d3f332c4-4c60-039e-0e1e-bc6b11831f87
Platform Id
fa70aa3f-a2de-be8b-4255-e778a6edb8ff
Article author
@tdykstra
Metadata
Related Issues
Associated WorkItem - 550679