ru Русский

Reticularium

NETWORKS PLACE

For some reason the example below taken from Apache documentation didn’t work for me

1
2
3
4
5
<Proxy balancer://mycluster>
BalancerMember http://192.168.1.50:80
BalancerMember http://192.168.1.51:80
</Proxy>
ProxyPass /test balancer://mycluster

That is, it did work, but mod_dir was adding trailing slashes to both host and path, like this: http://www.example.com/mypath --> http://www.example.com//mypath/ if it found mypath to be a directory of course.

Well, perhaps there is some reason for this that I couldn’t find, but the working solution I found is to add slashes to BalancerMember declarations, like so:

1
2
3
4
5
<Proxy balancer://mycluster>
BalancerMember http://192.168.1.50:80/
BalancerMember http://192.168.1.51:80/
</Proxy>
ProxyPass /test balancer://mycluster

UPDATE

This needs an additional investigation, it seems that this may affect other things, namely PHP $_SERVER variables may get messed up. This doesn’t necessarily mean this solution is wrong, but it requires a deeper look.

The better solution is to use Nginx as a proxy balancer anyway :)