3
XMLHttpRequest cannot load http://server.chatcoding.net:8000/socket.io/
socket.io.js.
Origin http://www.chatcoding.net is not allowed by Access-Control-Allow-Origin. 

That thing is preventing the socket script from loading. What happened here? It's still on the same domain, but why is it emitting that error?

Anyone? Thank you. :)

thisjt
  • 123
  • 2
  • 12

4 Answers4

3

You are on a same domain, but different ports (80 and 8000; source). the cross-domain policy is then applied. Try to setup your response header like that :

response.setHeader("Access-Control-Allow-Origin", "*")
Yooz
  • 2,446
  • 19
  • 30
0

please check if CORS is enabled on your server. Refer to http://enable-cors.org/server.html for help on how to enable it.

Kind regards

Marco
  • 20,296
  • 6
  • 68
  • 109
0

Looks like a sub-domain issue. You'll need to check who is requesting your page and if they are allowed (such as any sub-domain), send the header.

I used this to answer this question: https://stackoverflow.com/a/9737907/1215393

Community
  • 1
  • 1
Jared
  • 2,908
  • 4
  • 25
  • 41
0

server.chatcoding.net and www.chatcoding.net are basically two different domains(but the subdomains are same).