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

allowRequest failures now return 403 Forbidden #452

Merged

Conversation

darrachequesne
Copy link
Member

@darrachequesne darrachequesne commented Dec 1, 2016

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

When allowRequest option is provided and fails for a request (for example when checking the allowed origins in socket.io), the client receives:

400 Bad Request
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://b.local /* but only a.local is allowed */

New behaviour

The client will now receive a 403 response, without CORS headers.

Other information (e.g. related issues)

Closes #449
Related: #211 & #281

@darrachequesne
Copy link
Member Author

cc @akamensky @jdolega

@darrachequesne darrachequesne merged commit f72f6f3 into socketio:master Dec 22, 2016
@darrachequesne darrachequesne deleted the fix/cors-whenforbidden branch December 22, 2016 07:41
@darrachequesne darrachequesne added this to the 2.0.0 milestone Jan 23, 2017
@Kenzku
Copy link

Kenzku commented Feb 3, 2017

Hej, how I can turn the CORS off to prevent things like this:

POST /socket.io/?EIO=3&transport=polling&t=1481690658797-5&sid=Dp18NNt_bWPkB4rGAAAP HTTP/1.1
Origin: https://evilhost.net

HTTP/1.1 400 Bad Request
Content-Type: application/json
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://evilhost.net
Date: Fri, 03 Feb 2017 12:52:00 GMT
Connection: keep-alive
Transfer-Encoding: chunked

28
{"code":0,"message":"Transport unknown"}
0

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

Successfully merging this pull request may close these issues.

Engine.io to not set CORS headers on error response
2 participants