Combining attributes of SetEnvIF in Apache 2.4
I would like to combine the following SetEnvIF
configuration into single line. Is it possible to do so?
SetEnvIF X-Forwarded-For ^(91\.148\.158\.226|77\.70\.95\.131) TRUSTED_IPS
SetEnvIf X-Real-IP ^(91\.148\.158\.226|77\.70\.95\.131) TRUSTED_IPS
Solution 1:
As per the docs, the attribute
of the directive actually accepts a regex, but no example is given in its section. Rather one can be seen under Environment Variables > Examples. In your case it would be:
SetEnvIF ^X-(?:Forwarded-For|Real-IP)$ ^(91\.148\.158\.226|77\.70\.95\.131) TRUSTED_IPS