Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Using haproxy-1.5, I have the following partial config:

    acl is_api hdr(host) -i api.example.com
    acl is_app hdr(host) -i app.example.com

Unfortunately, the above doesn't match a request that looks like:

GET / HTTP/1.1
Host: api.example.com:80

Far as I can tell, I need to do:

    acl is_api hdr(host) -i api.example.com
    acl is_api hdr(host) -i api.example.com:80
    acl is_app hdr(host) -i app.example.com
    acl is_app hdr(host) -i app.example.com:80

UGH. NO! HATE!

Is there a nicer way of doing this? Can I just tell haproxy to ignore the port in the host header?

share|improve this question

1 Answer 1

You might be able to get this to work by checking hdr_dom (https://code.google.com/p/haproxy-docs/wiki/MatchingLayer7) instead of hdr:

acl is_api hdr_dom(host) -i api.example.com
acl is_app hdr_dom(host) -i app.example.com

Just be careful because I believe this would also match things like "otherstuff.api.example.com".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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