I need to set a http-response header under certain conditions.
My idea was to use this configuration in the frontend section:
acl path_set path_beg /some/path
http-response del-header Pragma if path_set
http-response set-header Cache-Control no-cache if path_set
http-response set-header Expires -1 if path_set
However, if I run a check on the config, haproxy tells me:
acl ‘path_set’ will never match because it only involves keywords that are incompatible with ‘frontend http-response header rule’
And indeed, the rule does not work. If I remove the condition (if…) the headers are set but of course for all paths.
Can someone help me understand, why this happens and how I prevent/fix this, so the condition works?
edit: I use haproxy version 1.6.13 on this server. Could it be a version problem?