NginX SSL reverse mode, client ip address problem

WANJUNE nginx-forum at nginx.us
Sun Dec 6 06:14:30 UTC 2015


In NginX reverse mode,

There is a problem that can't get real client's Ip address.

If I use Http protocol, I can simply handle this problem with below http
configuration.

http {
        server {
        listen 80;
        location / {
            proxy_set_header X-forwarded-for;
            proxy_pass http://destAddress;
        }
    }
}

The problem is in SSL.

I don't want to use http ssl listen becase of SSL handshaking burden on
NginX.

I decided to use stream codec like below.

stream {
    upstream aa34 {
        zone first_row 64k;
        server google.com fail_timeout=5s;
    }
    server {
        listen 127.0.0.1:8081;
        location / {
            proxy_pass https://aa34;
    }
}
In this case, I think I can't specify any http related parameters like
'X-forwarded-for'.
Is there any way to change source ip address of TCP/IP Protocol header(Ip
Header) to client's real Ip ?

Thanks.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,263299,263299#msg-263299



More information about the nginx mailing list