Wildcard in subdomain for ACL in HAPROXY
Asked Answered
S

1

8

Trying to match the following in haproxy:

acl instagiveweb hdr_beg(host) -i foo*.something.com

where the url could be foo-staging.something.com or foo.something.com

I've looked through the docs at https://www.haproxy.com/doc/aloha/7.0/haproxy/acls.html#data-types-and-matching-between-samples-and-patterns but having a hard time finding the pattern matching that I need.

Any help appreciated!

Suzisuzie answered 12/5, 2016 at 18:34 Comment(1)
If a regex is accepted, try acl instagiveweb hdr_beg(host) -i foo[^.]*.something.com or acl instagiveweb hdr_beg(host) -i foo(-staging)?.something.comMchugh
S
14

You want hdr_reg() ("reg"ex), not hdr_beg() (literal string prefix/"beg"inning).

acl instagiveweb hdr_reg(host) -i ^foo[^\.]*\.example\.com$

This should match the entire host header only if begins with foo followed by 0 or more of any character except . followed by .example.com at the end of the value.

Schmid answered 13/5, 2016 at 0:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.