-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Crossdomain - Handshake but "XMLHttpRequest cannot load" #1046
Comments
Is your CPU at 100% for node? I noticed this happening as socket.io is using 100% or more of my cpu and then occasionally I get an xhr request that doesn't complete in time and then I see that error in my browser. I tried extending some timeouts which seemed to help: io.set('heartbeat interval', 45); |
crickeys Thanks for your comment but it didn't worked .... here are my codes : server side : var io = require('socket.io').listen(8888); io.set('heartbeat interval', 45); io.sockets.on('connection', function(socket){
}); Client Side : <script src="socket.io.js"></script>$(document).ready(function() {
}); |
I just ran into what I think is the exact same issue and after a lot of code digging, I've found a work around. Long story short, when you tell Socket.io to listen on a port (i.e. not let it default to 80), a default HTTP request handler is created (line 69 of socket.io.js). This default handler automatically writes to and ends the request which prevents the Access-Control-Allow-Origin header from being written to the request by the Manager request handler. The solution I'm using for now is to dynamically remove this default handler in my own code (so not editing any Socket.io code here): io = io.listen(8888);
io.server.removeListener('request', io.server.listeners('request')[0]); This works for me. I still think there should be some sort of fix or added option around this though as I don't feel the above to necessarily be stable in the wake of future Socket.io code changes. |
mattcodez is right and his solution works so far :) |
+1 |
Thanks @mattcodez that was annoying. |
I have exactly the same problem between my two servers, the handshake is made but I have the folllowing error.
XMLHttpRequest cannot load http://www.SERVER:8111/socket.io/1/?t=1349514190664. Origin http://CLIENTSERV.com is not allowed by Access-Control-Allow-Origin.
tryed the origin parameters and I've uploaded the socket.io.js file on the client server... can"t see why I have so much ifficulties to make that work since I have
info - socket.io started
debug - client authorized
info - handshake authorized KdzAXjXfzP3JfRoZUCMa
Any one can help me ? I'm getting desperate
The text was updated successfully, but these errors were encountered: