hdr(host) includes port?

2013-06-16 Thread pechspilz
Hi there,

Is the port part of a HTTP header hostname? It looks like, because
depending on the frontend port I have to do something like this:

if { hdr(host) -i haproxy-rulez.net:8181 }
...if the frontend is bound to :8181

I'd prefer to just write
if { hdr(host) -i haproxy-rulez.net }
...no matter what port the frontend is bound to.

That way I wouldn't have to remember to change the port in the ACL if I
decide to change the frontend port. I know I probably could use hdr_beg
instead but I'd prefer a full hostname match.

Cheers


RE: hdr(host) includes port?

2013-06-16 Thread Lukas Tribus
Hi!

 That way I wouldn't have to remember to change the port in the ACL if I
 decide to change the frontend port. I know I probably could use hdr_beg
 instead but I'd prefer a full hostname match.


Why not use something like this:
 if { hdr(host) -i haproxy-rulez.net } || { hdr_beg(host) -i haproxy-rulez.net: 
}


That way you are still fully matching the hostname, expect when a port is
given, at which point hdr_beg is doing its job. There is no possibility
that this matches hostnames like haproxy-rulez.net.blabla.org, because the
double dot is included in the hdr_beg acl.



Regards,

Lukas