G
G
Galdar Turin2020-04-14 16:16:31
Nginx
Galdar Turin, 2020-04-14 16:16:31

How to send client's real ip address after connection redirect?

It turns out that when you connect to the site via the /connect/ directory, the connection is redirected to the local address and there is a problem, when you request the ip of the connected client, it gives out the local address. How to save the ip address of the client?

upstream backend_hosts {
                server local_ip_address:port;
        }

  location /connect/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
    proxy_pass http://backend_hosts;
  }

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