Port restore problem of reverse proxy after login.

Hongyi Zhao hongyi.zhao at gmail.com
Sat Nov 6 07:24:34 UTC 2021


I've nginx installed on my Ubuntu based VPS with the domain name
my.domain.xyz. A socks5 proxy listening on port 6001 of the VPS which
can access the intranet website 10.8.10.220:2021. Now, I run socat as
following on the VPS:

$ socat -v -d -d TCP4-LISTEN:2021,fork,reuseaddr
socks5:127.0.0.1:10.8.10.220:2021,socks5port=6001

Then I configure a reverse nginx proxy as follows:

    server {
        listen       8888;
        location / {
            proxy_pass http://localhost:2021;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

The above configuration will let me access the intranet website
10.8.10.220:2021 from outside with the following URL:
http://my.domain.xyz:8888.

The intranet website 10.8.10.220:2021 need login with specific
username and password. After I open http://my.domain.xyz:8888 and then
do the login, the URL always changes to the following form:

http://my.domain.xyz:2021

This will cause subsequent operations to fail. Is there any way to
continue using port 8888 to solve this problem?

Regards,
HZ


More information about the nginx mailing list