Ad Not Working With Nginx And Https

- 1 answer

I have a React app communicating with a very simple node backend, it works perfectly fine in local and was working perfectly fine over http. For obvious reason, the app is now running in https but the socket is not connecting anymore. I have been looking to so many threads but couldn't find a way to fix it. Here are the socket parts of my code and nginx conf.

Client side:

const socket = io('wss://', { path: '/my-path',});

Server side:

const server = require('http').createServer();

const io = require('')(server, {
    path: '/my-path',
    serveClient: false


nginx proxy

server { serving part...

      location /my-path/ {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;

Error is: GET net::ERR_CONNECTION_TIMED_OUT VM17:1 which looks like a timeout because it fails to connect.



So I found an answer after so many hours and it is pretty dumb and simple. My Nginx only handle the www website (DNS redirection is enough for the website), hence I needed here:

const socket = io('wss://', { path: '/my-path',});