Hi,

On Sat, Jun 23, mlist wrote:
> using this config no header is added to client from haproxy:
> 
> acl is_test hdr_dom(host) -i www.url1.url2.com
> 
> http-response add-header X-Custom-Header YES if is_test

Most likely the host header is not available for the http-response/acl.

For example with this config:
frontend test_fe
    bind [email protected]:8080
    acl is_test hdr_dom(host) -i www.url1.url2.com
    http-response add-header X-Custom-Header YES if is_test
    default_backend test_be

backend test_be
    http-request deny deny_status 200

haproxy complains:
[WARNING] 175/094858 (14971) : parsing [tmp_resp_header.conf:24] : acl 
'is_test' will never match because it only involves keywords that are 
incompatible with 'frontend http-response header rule'

You can use captures / variables to "store" the host header:
https://www.haproxy.com/blog/whats-new-in-haproxy-1-6/

So for example:
frontend test_fe
    bind [email protected]:8080
        declare capture request len 64
        http-request capture req.hdr(Host) id 0
    acl is_test capture.req.hdr(0) -m beg -i www.url1.url2.com
    http-response add-header X-Custom-Header YES if is_test

-Jarno

-- 
Jarno Huuskonen

Reply via email to