Skip to main content
added access control
Source Link
Freddy
  • 26.3k
  • 1
  • 27
  • 64

Move the specific ProxyPass directives before the balancer ProxyPass which then matches everything else with /. And remove the trailing slashes.

Here's the first vhost:

<VirtualHost *:80> ProxyRequests off #Start Proxy balancer block and define cluster <Proxy balancer://thecluster> BalancerMember http://172.31.27.155:8080 BalancerMember http://172.31.21.185:8080 loadfactor=3 BalancerMember http://172.31.28.201:8080 #weighted traffic byte count balancing ProxySet lbmethod=bytraffic nofailover=off </Proxy> ProxyPass /worksa http://172.31.27.155:8080 ProxyPass /worksb http://172.31.21.185:8080 ProxyPass /worksc http://172.31.28.201:8080 # pass through balancer member ProxyPass /a http://172.31.27.155:8000 ProxyPass /b http://172.31.21.185:8000 ProxyPass /c http://172.31.28.201:8000 # pass through any other proxy requests ProxyPass / balancer://thecluster/ #route traffic back through the cluster and act as a load balancer, ensure headers generated from$ #ProxyPassReverse / balancer://thecluster/ </VirtualHost> 

You might need to tweak access control on the backend to prevent a "403 Forbidden":

<Location /server-status> SetHandler server-status # limit to ip addresses, hosts or whatever you need Require ip 172.31 </Location> 

Move the specific ProxyPass directives before the balancer ProxyPass which then matches everything else with /. And remove the trailing slashes.

Here's the first vhost:

<VirtualHost *:80> ProxyRequests off #Start Proxy balancer block and define cluster <Proxy balancer://thecluster> BalancerMember http://172.31.27.155:8080 BalancerMember http://172.31.21.185:8080 loadfactor=3 BalancerMember http://172.31.28.201:8080 #weighted traffic byte count balancing ProxySet lbmethod=bytraffic nofailover=off </Proxy> ProxyPass /worksa http://172.31.27.155:8080 ProxyPass /worksb http://172.31.21.185:8080 ProxyPass /worksc http://172.31.28.201:8080 # pass through balancer member ProxyPass /a http://172.31.27.155:8000 ProxyPass /b http://172.31.21.185:8000 ProxyPass /c http://172.31.28.201:8000 # pass through any other proxy requests ProxyPass / balancer://thecluster/ #route traffic back through the cluster and act as a load balancer, ensure headers generated from$ #ProxyPassReverse / balancer://thecluster/ </VirtualHost> 

Move the specific ProxyPass directives before the balancer ProxyPass which then matches everything else with /. And remove the trailing slashes.

Here's the first vhost:

<VirtualHost *:80> ProxyRequests off #Start Proxy balancer block and define cluster <Proxy balancer://thecluster> BalancerMember http://172.31.27.155:8080 BalancerMember http://172.31.21.185:8080 loadfactor=3 BalancerMember http://172.31.28.201:8080 #weighted traffic byte count balancing ProxySet lbmethod=bytraffic nofailover=off </Proxy> ProxyPass /worksa http://172.31.27.155:8080 ProxyPass /worksb http://172.31.21.185:8080 ProxyPass /worksc http://172.31.28.201:8080 # pass through balancer member ProxyPass /a http://172.31.27.155:8000 ProxyPass /b http://172.31.21.185:8000 ProxyPass /c http://172.31.28.201:8000 # pass through any other proxy requests ProxyPass / balancer://thecluster/ #route traffic back through the cluster and act as a load balancer, ensure headers generated from$ #ProxyPassReverse / balancer://thecluster/ </VirtualHost> 

You might need to tweak access control on the backend to prevent a "403 Forbidden":

<Location /server-status> SetHandler server-status # limit to ip addresses, hosts or whatever you need Require ip 172.31 </Location> 
Source Link
Freddy
  • 26.3k
  • 1
  • 27
  • 64

Move the specific ProxyPass directives before the balancer ProxyPass which then matches everything else with /. And remove the trailing slashes.

Here's the first vhost:

<VirtualHost *:80> ProxyRequests off #Start Proxy balancer block and define cluster <Proxy balancer://thecluster> BalancerMember http://172.31.27.155:8080 BalancerMember http://172.31.21.185:8080 loadfactor=3 BalancerMember http://172.31.28.201:8080 #weighted traffic byte count balancing ProxySet lbmethod=bytraffic nofailover=off </Proxy> ProxyPass /worksa http://172.31.27.155:8080 ProxyPass /worksb http://172.31.21.185:8080 ProxyPass /worksc http://172.31.28.201:8080 # pass through balancer member ProxyPass /a http://172.31.27.155:8000 ProxyPass /b http://172.31.21.185:8000 ProxyPass /c http://172.31.28.201:8000 # pass through any other proxy requests ProxyPass / balancer://thecluster/ #route traffic back through the cluster and act as a load balancer, ensure headers generated from$ #ProxyPassReverse / balancer://thecluster/ </VirtualHost>