Skip to content

Access-Control-Allow-Origin - not possible to host application clients on other hosts #1442

@gcmartijn

Description

@gcmartijn

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');

            inspect = require('util').inspect;
            app = require('http').createServer(request_handler.handler);
            io = require('socket.io').listen(app,{
                    'pingTimeout':60000,
                    'transports':['xhr-polling','polling', 'websocket', 'flashsocket'],
                    'pingInterval':25000,
                    'allowUpgrades':true,
                    'cookie':'io'
            });

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.

  • I removed the original serverhost name and clienthost

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions