I inherited a haproxy server that was running the version 1.8. Upgraded it to version 2.1. Haproxy wouldn't restart. Found in the log that the issue was with this line in the configuration file:
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure
The error was
The 'rsprep' directive is not supported anymore since HAProxy 2.1. Use 'http-response replace-header' instead
Removed rsprep
and it worked. But I am now curious to know what impact it may have. How do I replace the above configuration using http-response replace-header
?
It looks like it's adding the word Secure
to the Cookie header value. It's doing a regex, capturing everything as group 1, then referencing group 1 and adding Secure to the end. Per docs.
Using replace header:
http-response replace-header Set-Cookie (.*) \1;\ Secure
There are more examples in the docs here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With