I'm trying to set some specific headers based on the client IP address via an Apache reverse proxy. I try to use SetEnvIfNoCase/SetEnvIf but I somehow fail to write a correct regular expression :(
Here what I tried to set in httpd.conf (assume that the reverse proxy directives are ok - they are):
SetEnvIfNoCase Remote_Addr "192\.168*" user_location_internal
RequestHeader set x-acme-user-location internal env=user_location_internal
Lets say that the request comes from 192.168.1.100. Then the regular expression is supposed to match - I tried it in several online validators that claim to be perl compliant and 192.168.1.100 matches to "192.168*". The documentation of SetEnvIf also claims to be perl reg ex compliant.
However it doesn't work. The only syntax that worked was following:
SetEnvIfNoCase Remote_Addr 192* user_location_internal
RequestHeader set x-acme-user-location internal env=user_location_internal
Then the header is set so the issue is somehow related to the regular expression syntax. So my best guess is that I'm not correctly escaping the dot. However according to: http://perldoc.perl.org/perlre.html#Regular-Expressions backslash is the correct symbol to escape metacharacters.
Any guesses what is wrong?