I need to load balance 3rd party services using HAProxy 1.7. Each of the servers requires unique Basic Auth Headers. I am looking for an approach similar to this below, where I can "roundrobin" between backend servers, but each server needs a different HTTP header:
frontend http-in
bind *:80
use_backend servs
backend servs
reqidel '^Authorization:.*'
reqadd 'Authorization: Basic blahblahblah'
server url1 asdf.example.com:8080 check ssl verify none
reqidel '^Authorization:.*'
reqadd 'Authorization: Basic blah2blah2blah2'
server url2 asdf.example.com:8081 check ssl verify none
This approach only ever uses the first server (url1).
hdr()function. It's not exactly what you want but it's a start. It might even be sufficient if you can use for example a second, dummy header. - Marshdr(). So let's say you create 2 additional custom headers and one of them would be intended for server 1 and the other for server 2. The Authorization header can be coupled with these additional headers. - Mars