Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

substring matching backend names... (no replies)

$
0
0
Hello again,

I was migrating a setup from the older style acl-based host to backend
mapping, to the newer map-based approach, e.g.

use_backend %[req.hdr(host),lower,map_beg(mapping.conf,default)]

and that works fine. But now I'm tempted to simply name the backends after
each servername, (eg. 'mail' from mail.google.com, or 'maps' from
maps.google.com).

Which in my imagination would look something like:

use_backend %[req.hdr_beg(host),lower]

But is there a way to substring or regex off the front of the host string,
and pass that to the use_backend call?

In other words, continuing the google.com example, if people are hitting
the server with "host: mail.google.com", and maps.google.com, and just for
completeness, notes.books.google.com, I'd like to have backends:

backend mail
mode http
foo
....

backend maps
mode http
bar
...

backend notes.books
mode http
baz
..

Is there a way to accomplish this without building them into a mapped file
in 1.5.x?

(1.6 solutions are okay too, but won't be able to move to that until it's
in stable.)

Phillip

Viewing all articles
Browse latest Browse all 5112

Trending Articles