0

I have a request from https://example.com to https://example.com:8080 which works here, however on another network and on a 4Glte network connection I get an error that https://example.com cannot read the message from example.com:8080/socket.io/.

I've setup my .htaccess to allow cross domain requests from the same domain, like this:

<IfModule mod_headers.c>
    <FilesMatch ".*$">
        Header set Access-Control-Allow-Origin https://example.com
        Header set Access-Control-Allow-Origin https://example.com:8080
        Header set Access-Control-Allow-Origin http://example.com
        Header set Access-Control-Allow-Origin http://example.com:8080
    </FilesMatch>
</IfModule>

And although this works from one connection, it doesn't work from the others. Why could this be?

JVE999
  • 3,327
  • 10
  • 54
  • 89
  • what do you see in the Network tab in Chrome DevTools/FireBug? Do you see this header in `example.com:8080/socket.io/` request? – Oleg Jun 04 '14 at 07:27
  • Yes, so even stranger. I'm wondering if it's because of the server firewall. I opened up the appropriate port and I'll be able to check tomorrow. – JVE999 Jun 04 '14 at 09:25
  • Maybe [this](http://stackoverflow.com/a/21711242/2600208) will help – Oleg Jun 04 '14 at 17:20
  • 1
    BTW, it seems that it's impossible to set multiple `Access-Control-Allow-Origin` headers. If you do that, the last value will overwrite all previous. But, you can compare `HOST` request header with origins you want to allow, and if they are equal - set `*` as `Access-Control-Allow-Origin` value. socket.io does this way, as you can see in my previous comment's link. – Oleg Jun 04 '14 at 17:36

1 Answers1

0

It turns out it was a firewall issue that was being reported as a cross-domain request issue, so something to keep in mind for anyone who has a similar question.

JVE999
  • 3,327
  • 10
  • 54
  • 89