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 Now, I run socat as
following on the VPS:

$ socat -v -d -d TCP4-LISTEN:2021,fork,reuseaddr

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 from outside with the following URL:

The intranet website 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:


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


More information about the nginx mailing list