Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The NodeJS server starts and works as a charm as long as I'm on localhost, and use localhost in my config for NodeJS.
But when I try to move the NodeJS and website to another server I get this in my browser console log:
XMLHttpRequest cannot load http://php55.local:8888/socket.io/?EIO=2&transport=polling&t=1402903467517-45. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://php55.local' is therefore not allowed access. dblog:1
XMLHttpRequest cannot load http://php55.local:8888/socket.io/?EIO=2&transport=polling&t=1402903473518-46. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://php55.local' is therefore not allowed access.
My nodejs.config.js:
backendSettings = {
"scheme":"http",
"host":"php55.local",
"port":8888,
"key":"/path/to/key/file",
"cert":"/path/to/cert/file",
"resource":"/socket.io",
"publishUrl":"publish",
"serviceKey":"aaa",
"backend":{
"port":80,
"host":"php55.local",
"messagePath":"/nodejs/message",
"basePath":"/dotc"},
"clientsCanWriteToChannels":false,
"clientsCanWriteToClients":false,
"extensions":"",
"debug":true,
"transports":["websocket",
"flashsocket",
"htmlfile",
"xhr-polling",
"jsonp-polling"],
"jsMinification":true,
"jsEtag":true,
"logLevel":1};
My config from "admin/config/nodejs/config" screenshot attached.
Comment | File | Size | Author |
---|---|---|---|
#1 | Selection_e1bc_001.png | 71.04 KB | tlyngej |
Comments
Comment #1
tlyngej CreditAttribution: tlyngej commentedComment #2
tlyngej CreditAttribution: tlyngej commentedComment #3
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedHere are some urls that might help the developers on this:
nodejs + express + cors: http://stackoverflow.com/questions/22230520/no-access-control-allow-orig...
http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-o...
http://stackoverflow.com/questions/20035101/no-access-control-allow-orig...
http://stackoverflow.com/questions/10143093/origin-is-not-allowed-by-acc...
Comment #4
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedthis happened on 7.x-1.8 and the June 17 dev version
Comment #5
javi.pl CreditAttribution: javi.pl commentedSame problem here, after i downgrade module to 7.x-1.7 problem with "XMLHttpRequest" is gone and i can play again. But it's not a solution at the end.
Comment #6
LeoCR2017 CreditAttribution: LeoCR2017 as a volunteer commentedI fixed the same issue,with a simple Javascript method called Location.replace() ,in my case this error occurs on the DOM not in the backend