In Apache2 HTTP I'd like to redirect or proxypass conditionally. For instance, I'd like to proxypass to a specific backend if the client's IP addr. is private. Otherwise, I'd like to redirect to "/".
<Location /whatever>
<If "-R '192.168.0.0/16' || -R '172.16.0.0/12' || -R '10.0.0.0/8'">
ProxyPass https://backend/
ProxyPassReverse https://backend/
</If>
<Else>
Redirect /
</Else>
</Location>
The above configuration leads to this error message:
ProxyPass cannot occur within <If> section
Why not? In any case, is there a workaround?
Thanks