set_real_ip_from, real_ip_header directive in ngx_http_realip_module

Maxim Dounin mdounin at mdounin.ru
Mon Jul 3 13:09:19 UTC 2017


Hello!

On Mon, Jul 03, 2017 at 04:57:31AM -0400, foxgab wrote:

> Thinks for you reply.
> i got a problem on http_realip_module, as what you said, duplicate addresses
> occurred in that header.
> if i want to get the real ip for access limiting, and append the last hop
> proxy address in X-Forwarded-Fro header at the same time, what should i do?

There are two basic options:

1. Avoid using the realip module.  You can still do access checks 
using the "if" directive - and, for example, appropriate geo 
blocks.

2. Avoid using $proxy_add_x_forwarded_for.  You may add the 
original address yourself, using the $realip_remote_addr variable 
and appropriate map{} blocks.

Alternatively, you may want to rethink your setup to simply avoid 
one or the another.

-- 
Maxim Dounin
http://nginx.org/


More information about the nginx mailing list