L
L
lotcovers2019-08-13 23:48:15
Nginx
lotcovers, 2019-08-13 23:48:15

How to make WebSocket work through a proxy server?

There is a js script that connects to a web socket server.
It is necessary to make the server see the IP of the proxy server, not the user.
I have many IPv4 proxies of the IP:[email protected]:PASS type, you need to use them, and not just one nginx server with a config that will serve as a bridge.
That is, if you use the config

location /wss {
        proxy_pass https://domain.com/chat;
        proxy_set_header Origin https://www.domain.com;
        proxy_set_header Host domain.com;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

Then all connections will go from the IP of this server, and I need to use a separate IPv4 proxy for each connection.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question