I have a Ubuntu 12.04.3 server set up acting as DNS server (BIND9), web server (Apache2) and a reverse proxy server (haproxy). My goal is to have haproxy redirect to some of the other servers on the network, some of which I want to redirect to a 'sub URL' (Not sure that's the right term. Please see the example below)
user goes to "monitor.example.com" > haproxy redirects to > "1.1.1.1:80/nagios"
My DNS server is set up using wildcard subdomains, and right now if I go to monitor.example.com it goes to the default apache page on the monitor server, but it would look a lot nicer and be a lot shorter to type if I could get it to direct to the /nagios page automatically. If I go to monitor.example.com/nagios it works as expected, but it's a little redundant.
I spent a while searching for a solution, but I'm not having any luck finding the answer to my question. Does anyone have any idea if this is possible and if so how I might solve it? Here is my haproxy.conf file:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
frontend http-in
bind 1:80
acl host_apache hdr(host) -i example.com
acl host_monitor hdr(host) -i monitor.example.com
acl host_cloud hdr(host) -i cloud.example.com
use_backend apache if host_apache
use_backend monitor if host_monitor
use_backend cloud if host_cloud
backend apache
server web3 127.0.0.1:81
backend monitor
server monitor 1.1.1.1:80/monitor
backend cloud
server cloud 2.2.2.2:80
If anyone has any other suggestions or a different program I could use to achieve my goal, I'm open to suggestions. I'm not using haproxy for any particular reason. I've tried pound too, but could not get it configured either.
Thanks for reading!
Brigzzy