Having trouble setting headers with an ACL

I want to set a header if the request is to a particular domain. I am trying to do it on the front end but unfortunately I cant get it to work and I get config warnings. These are what I have tried:

http-response add-header X-SITE-NAME str(“PRODUCTION”) if { %[req.hdr(Host),lower] -i app.site.com }
http-response add-header X-SITE-NAME str(“TEST”) if { %[req.hdr(Host),lower] -i test.site.com }
http-response add-header X-SITE-NAME str(“DEMO”) if { %[req.hdr(Host),lower] -i demo.site.com }
http-response add-header X-SITE-NAME str(“STAGING”) if { %[req.hdr(Host),lower] -i staging.site.com }

[ALERT] 052/103733 (1783115) : parsing [/etc/haproxy/haproxy.cfg:78] : error detected while parsing an ‘http-response add-header’ condition : unknown fetch method ‘%[req.hdr’ in ACL expression ‘%[req.hdr(Host),lower]’.

I also tried making ACLs and then setting if the ACL is true:

acl PRODUCTION %[req.hdr(Host),lower] -i app.site.com
acl TEST %[req.hdr(Host),lower] -i test.site.com
acl DEMO %[req.hdr(Host),lower] -i demo.site.com
acl STAGING %[req.hdr(Host),lower] -i staging.site.com

http-response add-header X-SITE-NAME str(“PRODUCTION”) if PRODUCTION
http-response add-header X-SITE-NAME str(“TEST”) if TEST
http-response add-header X-SITE-NAME str(“DEMO”) if DEMO
http-response add-header X-SITE-NAME str(“STAGING”) if STAGING

but get a similar error. I have tried using alternate methods of querying the host header but also get errors. For example:

acl PRODUCTION hdr_dom(host) -i app.site.com
http-response add-header X-SITE-NAME str(“PRODUCTION”) if PRODUCTION

Error:

[WARNING] 052/104214 (1783175) : parsing [/etc/haproxy/haproxy.cfg:90] : acl ‘PRODUCTION’ will never match because it only involves keywords that are incompatible with ‘frontend http-response header rule’

any help or suggestions greatly appreciated!