In Apache how can I set a ProxyPass rules depending on %{REMOTE_ADDR}?

Viewed 11

In Apache >2.4 used as reverse proxy I'm trying to send all requests from a specific IP (or a range of IP) to one WebServer and all others ip to another Webserver.

####### ProxyPass depending on designed IP #######
        RewriteCond %{REMOTE_ADDR} =$designedIP
        RewriteRule ^/(.*) https://webserver1.domain.com/$1 [P] connectiontimeout=60 timeout=600
        ProxyPassReverse / https://webserver1.domain.com/
        ####### ProxyPass depending on non designed IP #######
        RewriteCond %{REMOTE_ADDR} !=$designedIP
        RewriteRule ^/(.*) https://webserver2.domain.com/$1 [P] connectiontimeout=60 timeout=600
        ProxyPassReverse / https://webserver2.domain.com/
########################################################
0 Answers
Related