You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is wrong because Origin header tells us that we actually are allowed there. This is also incorrect from specification point of view.
From www.w3.org:
The Access-Control-Allow-Origin header indicates whether a resource can be shared based by returning the value of the Origin request header, "*", or "null" in the response.
Same time the standard does not specify response code.
Possible solution:
Either return Access-Control-Allow-Origin: null (as per specs), or completely drop CORS headers as it will trigger browser to display console error of missing header (latter is my preferred option)
Suggestion is to change from 400 Bad Request to 403 Forbidden as it more precisely reflects actual status of response (request itself may be not _bad_, but it is not allowed there).
Please vote if you agree and I will provide PR for this issue.
The text was updated successfully, but these errors were encountered:
@guille, Client actually does handle them exactly same way, both treated as error response and thus request marked as failed (at least that is how all major browsers do it). The code is more of a conventional way to show humans who check those logs what sort of error happened.
What about first point? should i do option 1 or 2? (1= Access-Control-Allow-Origin: null, 2= no header)
In my code:
If I do request from
http://b.local:80
, the response headers are:Which is wrong because Origin header tells us that we actually are allowed there. This is also incorrect from specification point of view.
From www.w3.org:
Same time the standard does not specify response code.
Possible solution:
Access-Control-Allow-Origin: null
(as per specs), or completely drop CORS headers as it will trigger browser to display console error of missing header (latter is my preferred option)400 Bad Request
to403 Forbidden
as it more precisely reflects actual status of response (request itself may be not _bad_, but it is not allowed there).Please vote if you agree and I will provide PR for this issue.
The text was updated successfully, but these errors were encountered: