-
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
Access-Control-Allow-Origin - not possible to host application clients on other hosts #1442
Comments
check mine, I replicated the issue.. |
so , did you fix your issue? |
I'm going to use https://github.com/primus/primus so I can use socket.io when this fixed again. Its not really a solution, but maybe a better option. |
Hi, if you can replicate the issue you will see is not of a big deal, just not emiting right on connection would not give you anymore problems. |
I am currently experiencing the same issue |
I currently have this issue as well |
I solved my issue by removing the the transports options.... var express = require('express'); io.adapter(redis({ host: 'localhost', port: <port#>})); server.listen(<port#>, '', function(){ ........ |
You can host your application on a different host but make sure you server the client socket.io.js from the same host where you are trying to connect to. for example, my initial client code was this and it was throwing CORS error
once I modified it to this, it worked alright.
And my server code is,
|
yo lo solvente asi:
|
Pero esto no es muy seguro, tienes que specificar el domain. En este caso todo esabierto. This is not very secure, you should specify the domain. In this case everything is open |
Claro pero eso lo configura uno de acuerdo a su necesidad https://www.npmjs.com/package/cors aqui aparece como configurar de manera personalizada. Saludos.. |
I don't know if its an issue or a 'feature' but in the old version I can do something like:
io.set('Origin':'*')
The reason to do this is because our application will be hosted on many different hostnames (websites) (origins). And only one server host.
In other words, its not possible to host our application clients on other hosts.
We don't use express or other modules, to keep it as clean as possible.
request_handler = require('./request_handler');
app.listen(8090);
The error we get is:
OPTIONS http://_serverhost__:8090/socket.io/?EIO=2&transport=polling&sid=DWGmxtENtfqN_h1GAAAA No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://clienthost**' is therefore not allowed access. v1.js?c=b3f0c7f6bb763af1be91d9e74eabfeb199dc1f1f:5798
XMLHttpRequest cannot load http://serverhost:8090/socket.io/?EIO=2&transport=polling&sid=DWGmxtENtfqN_h1GAAAA. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://**_clienthost****' is therefore not allowed access.
The text was updated successfully, but these errors were encountered: