Trying to be clever and allow access depending on an environment variable. It doesn't seem to work (no errors, the expression is always false).
What I tried:
<VirtualHost *:80>
...
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
<If "reqenv('ENVIRONMENT_STATE') == 'dev'">
allow from 1.22.333.0/24
deny from all
</If>
<Else>
allow from all
</Else>
</Directory>
</VirtualHost>
Expected behavior:
If ENVIRONMENT_STATE
is set to 'dev'
, then restrict all access except from the mentioned IP.
Sources:
http://httpd.apache.org/docs/2.4/mod/core.html#else
https://httpd.apache.org/docs/2.4/expr.html