On Wed, Sep 3, 2014 at 3:03 AM, Brian Torres <[email protected]> wrote:
> is there a way to rig thousands of haproxy backends without enumerating each
> one? I've been attempting to route using use-server and server based on a
> header value but have so far failed. I've been trying things like this:
>
> # where X-Request-Proxy = http://example.internal:4180
> backend default
>      use-server l2_backend if { hdr(X-Request-Proxy) -i 4180 }
>      server l2_backend %[hdr(X-Request-Proxy)] weight 0
>
> I've asked a similar question in IRC to no avail!


Hi Brian,

You could do this with a few lines of configuration.
Define a frontend, where you duplicate your X-Request-Proxy into an
other header.
>From here, clean up everything but the port (or the relevant
information) in the new header.
In your backend, do something like this:
use-server %[hdr(X-New-Header)]
server 4180 1.2.3.4

the server name must be the information copied into the new header.

Cheers

Reply via email to