Search code examples
javascriptnode.jsmod-rewritesocket.iomod-proxy

JS file not being served over HTTPS


I have turned on HTTPS on a website, and I have discovered that a JS file that until now was being served correctly when requested from a script tag in my template is now failing all the time.

The request that works is something like:

http://dev.mysite.com:54346/socket.io/socket.io.js

And the one that doesn't is not that much different:

https://dev.mysite.com:54346/socket.io/socket.io.js

Looking at the output of lsof -i :5346 and top and stopping the script I've been able to figure out that a node script that we start with forever is actually somehow answering the petition that works, but not the other one. I don't know too much about node, but looking into the code of that script and its requirements (socket.io) I haven't seen anything that makes me think it could work only with HTTP and not with HTTPS.

I don't actually understand how does this work, because I haven't seen any configuration of Apache that could even remotely mean something like "redirect this requests to this process".

The only solution I could think of was to redirect the petition trough HTTPS to HTTP, but I tried using mod_proxy and mod_rewrite without any luck at all.

Thanks in advance!


Solution

  • I'm gonna mark this as resolved because we are pretty sure now it is more a nodejs issue than an Apache conf one. Thanks anyway, Ed Williams!