7

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!

9

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.

2
  • Just wondering what is hdr_beg(host), i think it means "host" "header begins" (hdr_beg) with – Deepak Deore May 1 '17 at 21:52
  • @DeepakDeore correct. More details in the Configuration Manual: haproxy.org/#docs – ThatGraemeGuy Jun 5 '17 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.