Indeed - I hardcode the frontend_name in the .cfg (instead of using %f), and it works.
Thanks much! On Fri, Mar 18, 2016 at 3:30 PM, Cyril Bonté <[email protected]> wrote: > Hi Jim, > > Le 18/03/2016 21:52, Jim Freeman a écrit : >> >> I'm trying to add a header only if the last occurrence of it is not >> the frontend_name (%f), but the header field name comparison seems to >> be case sensitive when it should not be ? > > > The analysis is not correct. > >> haproxy.cfg >> ======== >> listen foo.bar >> bind :10001 >> mode http >> log 127.0.0.1:514 local2 debug info >> >> acl XOH_OK req.hdr(X-Orig-Host,-1) -m str -i %f > > > The issue is here : this is not supposed to work (well, not as you thought). > ACLs don't support log-format variables for string comparison. > Here, you are asking to compare the "X-Orig-Host" header with the string > "%f". > >> http-request add-header X-Orig-Host %f unless XOH_OK >> # http-request add-header X-Orig-Host %f if !{ >> req.hdr(x-orig-host,-1) -m str -i %f } >> >> capture request header X-Orig-HoST len 64 >> >> server local localhost:80 >> >> curl test >> ======= >> curl -I -H 'X-Orig-Host: baz' -H 'x-oRiG-hOsT: foo.bar' -H 'Host: >> foo.bar' localhost:10001/ >> >> headers as seen by lighttpd >> ================= >> 2016-03-18 14:45:26: (request.c.311) fd: 7 request-len: 135 >> HEAD / HTTP/1.1 >> User-Agent: curl/7.38.0 >> Accept: */* >> X-Orig-Host: baz >> x-oRiG-hOsT: foo.bar >> Host: foo.bar >> X-Orig-Host: foo.bar >> >> haproxy with this config should *not* have added the last header ??? > > > To illustrate what I previously wrote, you can try : > curl -I -H 'X-Orig-Host: baz' -H 'x-oRiG-hOsT: %f' -H 'Host: foo.bar' > localhost:10001/ > > You'll probably see that haproxy will not add a third header. > > > >> >> System: >> root@jfree:~# haproxy -v >> HA-Proxy version 1.6.3 2015/12/25Debian Jessie, haproxy from backports >> https://packages.debian.org/jessie-backports/haproxy >> >> BTW - haproxy well and truly rocks ... >> > > > -- > Cyril Bonté

