Rspirep - HAProxy Upgrade - Looking for Help!

Hi All,

I am trying to upgrade the HAProxy version from 2.1 to 2.4, and as everyone’s already aware that Rspirep is no longer supported in the upgraded version. Hence, I need to use http-response replace-header instead. I have tried the below format, and the updated config is syntactically right. However, the application is breaking because a particular cookie is missing now post upgradation.

Please find the details below (attached ACL too for reference),

Old format:
acl hdr_set_cookie_vcap_myaccount res.hdr(Set-Cookie) -m reg -i JSESSIONID(.*)Path=/myaccount
rspirep ^(Set-Cookie:.*)_VCAP_ID_=(.*)\ Path=(/[a-z]*?)(.*) \1__VCAP_ID__=\2\ Path=/myaccount\4;\ Secure;\ HttpOnly if hdr_set_cookie_vcap_myaccount
rspirep ^(Set-Cookie:.*)JSESSIONID=(.*)\ Path=(/[a-z]*?)(.*) \1JSESSIONID=\2\ Path=\3\4;\ Secure;\ HttpOnly if hdr_set_cookie_vcap_myaccount

New Format:
acl hdr_set_cookie_vcap_myaccount res.hdr(Set-Cookie) -m reg -i JSESSIONID(.*)Path=/myaccount
http-response replace-header Set-Cookie ^(.*)_VCAP_ID_=(.*)\ Path=(/[a-z]*?)(.*) \1__VCAP_ID__=\2\ Path=/myaccount\4;\ Secure;\ HttpOnly if hdr_set_cookie_vcap_myaccount
http-response replace-header Set-Cookie ^(.*)JSESSIONID=(.*)\ Path=(/[a-z]*?)(.*) \1JSESSIONID=\2\ Path=\3\4;\ Secure;\ HttpOnly if hdr_set_cookie_vcap_myaccount

I would really appreciate the support, as I have tried several solutions and nothing works. Let me know if any further details are needed.

Thanks!

Take a look at what haproxy is actually returning, via browser developer tools (F12) or alternative via curl.

When you know what haproxy actually returns as oppossed to what haproxy should return, it will become clearer what needs to be done.

Thanks. I can see the endpoint is returning a 500 error response, whilst previously it was returning a 200 error response.

Below is the example endpoint,

https://example.com/myaccount/account

By inspecting the UI, I can see one of the set-cookies’ is missing in the response header. Interestingly, the missing header is not defined in the entire configuration file.

The issue was identified. It was due to missing ACL definition in the upgraded HAProxy version.

1 Like