'real_ip_header proxy_protocol' don't change the client address
Maxim Dounin
mdounin at mdounin.ru
Thu Sep 28 14:08:01 UTC 2017
Hello!
On Thu, Sep 28, 2017 at 04:54:41PM +0300, Maxim Dounin wrote:
> Hello!
>
> On Wed, Sep 27, 2017 at 10:38:45PM -0400, fengx wrote:
>
> > The config is rather simple as following. My test version is 1.7.2, a bit
> > old. I can't upgrade to the latest one in our production for now. Anyway I
> > think it should work in 1.7.2 because the document says proxy_protocol was
> > introduced from 1.5.12.
> >
> > http {
> > log_format combined '$proxy_protocol_addr - $remote_addr - $remote_user
> > [$time_local] '
> > '"$request" $status $body_bytes_sent '
> > '"$http_referer" "$http_user_agent"';
> > ...
> >
> > server {
> > server_name www.abc.com;
> >
> > listen 80;
> > listen 8181 proxy_protocol;
> >
> > real_ip_header proxy_protocol;
> > real_ip_recursive on;
> > set_real_ip_from 192.168.1.0/24;
> >
> > location / {
> > ...
> > }
> > }
> > }
>
> And how do you test?
>
> Exactly the same config, and even with exctly the same version of
> nginx works fine here:
Uhm, and one more note: exactly the same configuration will
produce the following error:
nginx: [emerg] duplicate "log_format" name "combined" in ...
It might be the reason why you are seeing incorrect address: you
are testing with some different configuration instead.
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list