HAProxy forward website to specific server

I Have a seperate webserver for a specific task. This webserver is running alone with a different configuration.

This website has the same public IP address as the rest of my websites and is also configured on my load balancer (HAProxy).

However, this specific website needs to be forwarded to a seperate server which is not part of the webserver pool.


This is how I did this in my HAProxy configuration:

frontend http-proxy
        option forwardfor
        option httplog
        acl is_testserver hdr(host) -i testserver.michielonline.nl
        use_backend httptest if is_testserver
        default_backend httpcluster
        log global

backend httpcluster
        balance roundrobin
        server web01 check cookie
        server web02 check cookie
        server web03 check cookie
        option httpchk HEAD / HTTP/1.1\r\nHost:localhost

backend httptest
        server cloud check cookie
        option httpchk HEAD / HTTP/1.1\r\nHost:localhost

The most important option is "acl is_testserver hdr(host) -i testserver.michielonline.nl", this tells the loadbalancer that the website with the hostname/serveralias "testserver.michielonline.nl" is part of an ACL, named: is_testserver.
The next part is if the ACL is found, the traffic is forwarded to: "backend httptest".

This forwarding is done by the option: "use_backend httptest if is_testserver".

All other traffic is sent to the default backend with the option: "default_backend httpcluster".