简体   繁体   中英

Hide clinet ip under reverse proxy nginx

I need the client to send and receive data from the proxy server, and the real server saw the ip of the proxy server, not the ip of the client. In essence, a mirror of the site. How many times have I tried the site always sees the original ip. I checked it with wget sending request to reverse proxy.

wget 123.123.123.123/ip
cat ip
*find ip in output of cat and there is no 123.123.123.123. There is my ip*

nginx config:

     server {
            listen      *;

            server_name browserleaks.com;

            location / {

                 proxy_pass https://browserleaks.com/;

            }

     }

As I understand it, I need to set headers like x-real-ip, but no matter what I do, it doesn't work

So, it... Works. Just needed clear cache in browser. Not even a headline was needed.

And if you wonna enable ssl change config to:

stream{
    server{
            listen 443;
            proxy_pass browserleaks.com:443;
    }
}

stream replaces http

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM