I am attempting to setup a reverse proxy to allow only a few select ip ranges to proxy to an internal host, while I would like anyone else not within the ip ranges to redirect to our internal named host. In this setup, the webservice will work while anyone who is not VPN'd into our network will not be capable of navigating to the internal resource. I have been attempting to get this to work without luck, my partial config is currently as follows:
ProxyRequests Off
<Proxy *>
Allow from all
</Proxy>
<Location />
Allow From xxx.xxx.xxx.xxx/24 1xxx.xxx.xxx.xxx/23
Deny From All
ProxyPass http://server.local.corp:8000/
ProxyPassReverse http://server.local.corp:8000/
</Location>
This config appears to work well for blocking other ip ranges from being able to proxy, however I am unclear how I can add a redirect statement for anyone else.
Edit Taking advice from the first answer my code now looks like:
<If "%{REMOTE_ADDR} -ipmatch 'xxx.xxx.xxx.xxx/24'">
ProxyPass / http://server.local.corp:8000/
ProxyPassReverse / http://server.local.corp:8000/
</If>
And apache throws the following error on restart:
ProxyPass cannot occur within <If> section
Action 'configtest' failed.
The Apache error log may have more information.