HAProxy community

How to load balance webapplication with /contextroot


I have a webapplication which is accessed as http://host:port/app.
I have 3 instances of this webapp:
http:// host:8080/app
http:// host:9080/app
http:// host:10080/app

Now I want to setup haproxy infront of it to load balance.
To start with I have install everything ha proxy and the 3 apps on the same host.
This is what I currently have in my haproxy setup which throws 503 Service unavailable error:
frontend webapp1
default_backend webapp1-servers

backend webapp1-servers
balance source
hash-type consistent
mode http
server webserver1
server webserver2
server webserver3

I tried accessing;; but same message - 503 Service Unavailable.

What am I missing? I am new user to HAProxy.



Your app must be configured to listen on a particular virtual host.
You may confirm it works when running

curl -v -H "Host: host"

Of course, replace host with your real app name.

Also enabling HAProxy health check may help a bit to troubleshoot and understand where the error may be.