Questions about real ip module

Francis Daly francis at
Wed Aug 3 22:53:15 UTC 2022

On Wed, Aug 03, 2022 at 02:58:59PM +0900, nanaya wrote:
> On Wed, Aug 3, 2022, at 07:34, Francis Daly wrote:
> > On Sat, Jul 30, 2022 at 05:13:52AM +0900, nanaya wrote:

Hi there,

> It looks like I tested it on location level. I guess it's similar behavior to real_ip_header inheritance you mentioned below?

Ah, I hadn't tested at location{} level.

I had thought it would basically be: wherever the real_ip_header that
is used is set, use the matching set_real_ip_from. But I see somewhat
confusing test results there now too.

So it's probably simplest to say that the current code works most clearly
when there is exactly one set of directives in the configuration.

If someone finds a use-case that they can't configure with the current
code, maybe that will inspire someone to change something.

> >> 2. does setting `real_ip_header '';` in a section effectively disable the module for the section?
> >
> > I don't see that it does; and I don't see that the documentation says
> > that it would. So I'd say "no, it does not".
> It seems to achieve the same effect though considering it's not really possible to send empty header (or is it?).

With the odd effective inheritance that I see, any "inner" directive
seems to be effectively ignored. So having an "inner" one with the empty
value should not make a difference.

But I do not understand fully what it is doing.

> Thanks. I've reworked the config so it's not needed anymore.

Good that you have a config that now works for you.


Francis Daly        francis at

More information about the nginx mailing list