Currently I am using the following haproxy version:
HA-Proxy version 1.8.19-1+deb10u3 2020/08/01
The following backend configuration snippet
backend radicale-https
...
acl hdr_location res.hdr(Location) -m found
rspirep ^Location:\ (http|https)://127.0.0.1\/(.*) Location:\ /radicale/ if hdr_location
...
I would like to upgrade to haproxy 2.2.3 with the following modification:
acl hdr_location res.hdr(Location) -m found
http-response replace-header ^Location:\ (http|https)://127.0.0.1\/(.*) Location:\ /radicale/ if { hdr_location }
However when checking the configuration with haproxy, I get the following error message:
[ALERT] 355/171925 (3198) : parsing [/etc/haproxy/haproxy.cfg:112]: 'http-response replace-header' expects either 'if' or 'unless' followed by a condition but found '{'.
Could someone support me on ho to migrate this configuration line correctly? Thank’s in advance!
OK, I’ve removed the {} signes around hdr_location and checked the configuration again:
[ALERT] 356/000752 (3122) : parsing [/etc/haproxy/haproxy.cfg:112]: ‘http-response replace-header’ expects either ‘if’ or ‘unless’ followed by a condition but found ‘hdr_location’
Something is still not OK. Any other idea?
I say again: the syntax between the two keyword is different, that is why you need to take a look at the documentation that I linked to above, so you know what to do.