In haproxy you do redirection combining acl
rules and redirect
ones; you choose the right server using the backend
rule.
The official haproxy documentation is not very easy to read, but it's very complete.
Something like this (just a sketch to give you an idea):
frontend http-in
mode http
bind FRONTENDIP:80 # eg. 100.100.100.100:80
default_backend tomcat_server_2
acl tomcat_1 hdr_end(host) -i www.xyz.com
acl tomcat_2 hdr_end(host) -i abc.xyz.com
acl tomcat_path path_beg /abc/
use_backend tomcat_server_1 if tomcat_1 !tomcat_path
backend tomcat_server_1
server tomcat1 10.0.0.1:8080 maxconn 1000
backend tomcat_server_2
server tomcat2 10.0.0.2:8080 maxconn 1000
If you want to redirect www.xyz.com/abc/
to abc.xyz.com
:
redirect prefix http://abc.xyz.com if tomcat_path