OK, I’m very new to haproxy and I’ve been beating my head against this problem for a few days and I’m sure I’m just overlooking something simple. I have five servers that each have three branded customer portals with their own URLs. Each server has a copy of each customer portal. In addition each server is listening for those same three URLs so that we could just change DNS from one server to another and have a working portal.
I would like to take those URLs and use haproxy to load balance amongst the five servers and also provide failover. Ideally haproxy would pass the original URL to the backend server so it loads the correct customer portal without having to have a different backend for each customer, but this is not necessary. Is this possible? If it’s not possible then I can create new portal URLs on each backend server so that each customer’s portal is entirely unique.
Where all my time has been spent is configuring acls. I’ve been trying to make haproxy look at the URL that is entered and send it to a different backend depending on the URL used. I cannot seem to make this work. To complicate matters further, I need haproxy to listen for http on port 80 and https on port 443 but redirect all requests to https.
Basically I want the flow to be as follows:
http(s)://portal.acme.com --> haproxy --> https://portal.acme.com on server 1, 2, 3, 4, or 5 by IP
http(s)://portal.delco.com --> haproxy --> https://portal.delco.com on server 1, 2, 3, 4, or 5 by IP
http(s)://portal.bluesea.com --> haproxy --> https://portal.bluesea.com on server 1, 2, 3, 4, or 5 by IP
If necessary I’m fine doing something like this, though:
http(s)://portal.acme.com --> haproxy --> https://portal.acme[1-5].com
http(s)://portal.delco.com --> haproxy --> https://portal.delco[1-5].com
http(s)://portal.bluesea.com --> haproxy --> https://portal.bluesea[1-5].com
My main question, how do I configure my acl to look at the original URL and send to a specific backend?
My second question, is it possible to pass the original URL to one of five servers by IP address?
I haven’t included my current config because it’s a huge mess and I’m afraid it will confuse matters more than help. If you would like to see it I’ll post it, though.
Any help anybody can provide will be very much appreciated! Thank you!!