kbang
kbang

Reputation: 704

route network traffic based on the subdirectory requested

I have 3 back end nodes to handle traffic but round robin doesn't work in my case. Is it possible to use Apache web server and route(proxy) all traffic from A-E to server 1, F-S to server 2 and T-Z to server 3? I don't want the url to change.

For example: build.amz.com/TEST should go to server 3 while build.amz.com/ECHO should go to server 1? I am new to Apache, any directions towards how to achieve this is helpful

Upvotes: 1

Views: 59

Answers (1)

Dusan Bajic
Dusan Bajic

Reputation: 10869

You can try something like this:

ProxyRequests Off
ProxyPreserveHost On

ProxyPassMatch ^/([A-Ka-k]+)(.*) http://server1/$1$2
ProxyPassReverse / http://server1/

ProxyPassMatch ^/([L-Pl-p]+)(.*) http://server2/$1$2
ProxyPassReverse / http://server2/

ProxyPassMatch ^/([Q-Zq-z]+)(.*) http://server3/$1$2
ProxyPassReverse / http://server3/

#ProxyPassMatch ^/(.*) http://serverdefault/$1
#ProxyPassReverse / http://serverdefault/

Upvotes: 1

Related Questions