Nginx Map how to check value if empty

Francis Daly francis at
Wed Mar 8 20:03:06 UTC 2017

On Tue, Mar 07, 2017 at 06:44:05PM -0500, c0nw0nk wrote:

Hi there,

> I was just looking at the realip module but that module does not seem to
> support fallback methods like I demonstrated I was in need of.

I'm not convinced that you need anything other than what the realip module
provides; but it's your system and you can configure it however you want.

If you can (temporarily) add a second access log file which uses a
format like:

remote_addr is $remote_addr and http_x_forwarded_for is $http_x_forwarded_for and http_cf_connecting_ip is $http_cf_connecting_ip

then you should be able to show one line which has $remote_addr being
a trusted address and the "end" bit of $http_x_forwarded_for not being
exactly what you want to use.

> (If it does
> support multiple headers and fallback conditions can someone provide a
> demonstration)

It doesn't; so if you need that, then you must build your own work-alike
(like you've done); or write or encourage some to write the code to
improve the realip module for this use case.

Francis Daly        francis at

More information about the nginx mailing list