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

Preflight handshake broken for credentialed CORS #30

Closed
thorlarholm opened this issue Mar 5, 2012 · 3 comments
Closed

Preflight handshake broken for credentialed CORS #30

thorlarholm opened this issue Mar 5, 2012 · 3 comments

Comments

@thorlarholm
Copy link
Contributor

Client handshakes under Cross-origin Request Sharing are not working properly if the following conditions are met

  1. Origin site and Tornadio service are running on different ports
  2. The origin site has a cookie set

Only condition 1 is guaranteed to be met for the crosssite example.

When both of these conditions are present, a CORS-compliant browser will attempt to use the withCredentials property of the XMLHttpRequest object. However, this requires that the following response header are set.

  • Access-Control-Allow-Origin: exactOrigin
  • Access-Control-Allow-Credentials: true

where exactOrigin is self.request.headers['origin'].

Expected results:

  • Access-Control-Allow-Origin: exactOrigin
  • Access-Control-Allow-Credentials: true

Actual results:

  • Access-Control-Allow-Origin: exactOrigin
  • Access-Control-Allow-Credentials: True

Browsers are strictly enforcing a case-sensitive header value, making True invalid and true valid.

This results in a broken handshake process for any socket.io-client later than 0.8.6.

Related documentation:
http://www.w3.org/TR/cors/#access-control-allow-credentials-respons
https://developer.mozilla.org/En/HTTP_Access_Control#Requests_with_credentials

Related issue in socket.io-client:
socketio/socket.io-client#333

@thorlarholm
Copy link
Contributor Author

Sorry, attached the commit to a separate "issue"

@mrjoes
Copy link
Owner

mrjoes commented Mar 6, 2012

Thanks for the fix :-)

@mrjoes mrjoes closed this as completed Mar 6, 2012
@thorlarholm
Copy link
Contributor Author

Related issue:

#31

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

No branches or pull requests

2 participants