Setting up HAProxy


I am new to HAProxy and I am trying to get HAProxy setup in a network like this:

It would be HAProxy pointing to multiple servers that are running their own containers that are open on different ports. The purpose of this setup would be allow the containers to operate using port 80 but have their own unique URLs.

I have looked on Google but I couldn’t find any config examples that would allow me to identify a requested URL and where should HAProxy point to.

Does anyone know of a good tutorial?


I suggest reading the starter guide:

For a specific example of howto content switch (which is what you are asking here; the “The old way of mapping” in the blog post is perfectly fine for 3 docker containers, you would use the map feature if you have hundreds or thousands of docker backends):

And you can refer to the configuration manual for specific options: