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
  • 163
  • 2
  • 14

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,506
  • 21
  • 31
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
  • 22,856
  • 9
  • 75
  • 124
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,978
  • 4
  • 26
  • 45
0

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