What does "acl cdn_name hdr_beg(host) -i foor.bar.com" mean in HAProxy's configuration?

I've recently taken over an environment using HAProxy, and I'm attempting to learn the config and what it all means, but I'm finding some aspects of it are not clear.

I think the above means that if host header begins with "foo.bar.com" then use the cdn cdn_name, but I'm not totally sure. Can somebody confirm for me?

Thanks!


Solution 1:

Close.

It's defining an ACL with the name cdn_name, with the criteria hdr_beg(host) -i foo.bar.com. The criteria basically means that the HTTP Host: header begins with "foo.bar.com" and it uses case-insensitive matching (the "-i" flag).

On it's own this doesn't actually do anything, but it will be used further down your config, where you will likely see something like this:

<something something> if cdn_name

What this does is if the client request uses a Host: header that begins with "foo.bar.com", HAproxy will do whatever is defined in the <something something> bit of the config.