Hi everybody,

the following users@ question is interesting in my opinion:

2017-02-20 18:17 GMT+01:00 Mike Schlottman <[email protected]>:

>
> The problem comes when I combine these 2 so that all users except those
> coming from 127.*.*.* or 192.168.*.* see the nice error page.
>
> <If  "! %{HTTP:X-Real-IP}  -ipmatch '127.0.0.0/8' ">
>
>   <If  "! %{HTTP:X-Real-IP}  -ipmatch '192.168.0.0/16' ">
>
>     ErrorDocument 404 /errors/404
>
>   </If>
>
> </If>
>
> The user from 172.28.1.84 does not get the nice 404 page, but the default
> 404 page.   The IP does not match either of the ranges as observed when
> using the ranges individually, but when combined in this way it does not
> work as expected.
>
>
>
> Any ideas why this is?
>
>
>

He ended up using a single if with an expression composed by the two
conditions in && to solve the problem, but I started to wonder why this
configuration does not work. I tested the "nested ifs" config with trace8
logging and it seem that only the outermost <If> expression gets evaluated.

Is there a specific reason why this happens? I'd expect two possible
outcomes from this configuration, namely either a syntax error while
parsing the config (preferred imho) or a context merge, but not a no-op.

Any pointers/suggestions about where to look?

Thanks!

Luca

Reply via email to