Skip to content
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

Set Access-Control-Allow-Origin header to * on 401 responses #730

Open
cbeauchesne opened this issue Oct 31, 2018 · 2 comments
Open

Set Access-Control-Allow-Origin header to * on 401 responses #730

cbeauchesne opened this issue Oct 31, 2018 · 2 comments
Labels

Comments

@cbeauchesne
Copy link
Member

cbeauchesne commented Oct 31, 2018

If a token is obsolete or corrupted, API answer 401 response (Not authorized).

But in this case, Access-Control-Allow-Origin header in response is not set.

This combinaison (401 + no ACAO header) is interpreted by browsers as an invalid CORS request, and thus, absolutly not response data is provided to client javascript, to prevent any invalid utilisation of CORS data.

To reproduce :

  1. on client side, send a XMLTHttpRequest to API with a fake Authorization header
  2. set a onreadystate callback on your request
  3. Try to see the response content in javascript : impossible. However, the response exists in dev console
@lbesson
Copy link
Member

lbesson commented May 3, 2021

see #1073 and Cornices/cornice#115

Updating cornice will probably solve the issue.

@lbesson
Copy link
Member

lbesson commented May 3, 2021

see also #720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants