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
CORS #2850
Comments
Same error |
@Kenzku @thEpisode Which version of socket.io are you using? It should be fixed in |
Hi @darrachequesne thanks for reply. I'm creator of Crawler Site (https://www.crawlersite.com) and we use Socket.io to send data to our servers and all our infraestructure is on Microsoft Azure, all test and first beta testers uses Azure and we haven't problems, but a new betatester use another cloud service provider and he reported a bug. The problem is CORS, we read all questions on Google!! and searching solutions we notice that Socket.io is updated to 2.0 (exactly 2.0.1 in server), we update client and server but problem persist, we use Express that also reported problems with CORS and we resolved it. We are very frustated because all solutions on Google didn't resolve the problem, sorry for no posting this on GitHub issues or StackOverflow but we want to give all details possible to solve it. Some URLs to test: Backend URI: http://crawlerbackend.azurewebsites.net Part of our app.js:
` |
Problem resolved!! @Kenzku please review this documentation: https://github.com/socketio/socket.io/blob/master/docs/API.md#serveroriginsvalue and see the code: https://github.com/socketio/socket.io/blob/master/lib/index.js#L67 and check if you use Express (this example is very useful): https://github.com/socketio/socket.io#in-conjunction-with-express |
Great! I guess we can close the issue now. |
@thEpisode I realize this is an old thread, but that final link was what fixed it for me! Most of the Express tutorials have |
@frewinchristopher i am following the same pattern as you mentioned above, locally its working fine but in remote it throws (Reason: CORS request did not succeed). where i am wrong..? |
@gowthamyaal could you show us your code? |
Thanks for your concern, but Solved the CORS issue, as I was using AWS there is a conflict with elastic ip and local ip, later i had changed the socket listening ip as 0.0.0.0, this solved my issue. |
Now facing the race condition issue in remote, i am using webpack-dev-config, i had tried to use io connect and emit code in the same file but end up with undefined error webpack-dev-config client socket code the commented lines did work for me.... could anyone help me with this....thanks in advance |
I have followed all of the solutions I could find and still have yet to send a working response. If someone could take a look I'd be very appreciative. `const express = require('express') // Host port const app = express() io.origins("http://localhost:3000") io.on('connection', socket => {
}) server.listen(port, () => console.log( |
hej,
how I can remove the response header
Access-Control-Allow-Origin
?looks like the settings
{'origins' : 'asfdasd.com'}
does not work.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:27:42 GMT
Connection: keep-alive
Transfer-Encoding: chunked
The text was updated successfully, but these errors were encountered: