I’m looking for a way to bypass the maintenance page on a backend (when all servers are in maintenance mode).
The solution we found is using force-persist but it doesn’t work without use-server.
And this last option doesn’t enable us to use/test load balancing while in maintenance.
The documentation doesn’t mention that force-persist need to be used with use-server or any other option.
But it tells that it works on frontend, backend and listen which, I assume, means force-persist support other options.
Any idea how to achieve this with force-persist or something else?
What is the exhaustive list of options which can be combined with force-persist?
Our bypass conditions are requests coming from some IPs or having a cookie set to true.
(the bypass can be disabled by the clients using an authorized IP with to the cookie set to false)
You don’t have any persistence configured, so forcing persistence is not going to achieve anything.
How would you like haproxy to bypass maintenance mode? How should haproxy pick the server? Via cookies?
Try setting up cookies persistence without any cookie insertion, and then you can manually switch it on by setting the cookies in the browser:
Then, in your browser set the cookie “hap_bypass_secretkeyblabla” to srv-app-01 or srv-app-02 respectively, for example in Chrome via the developertools console:
You can assign the same cookie to multiple servers, I believe force-persist should still work. However, you can’t force persistence when no persistence is actually configured.
Also, doublecheck that haproxy doesn’t actually emit the cookies, if that is not what you want and I’d still recommend you use the force-persist option with an IP ACL, to whitelist only specific IPs.