Hi, On Sat, Apr 27, 2024 at 02:06:54AM +0200, Aleksandar Lazic wrote: > Hi Lokesh. > > On 2024-04-27 (Sa.) 01:41, Lokesh Jindal wrote: > > Hey folks > > > > I have found that there is no operator "del-cookie" in HAProxy to delete > > cookies from the request. (HAProxy does support the operator > > "del-header"). > > > > Can you explain why such an operator is not supported? Is it due to > > complexity? Due to performance? It will be great if you can share > > details behind this design choice. > > Well I'm pretty sure because nobody have added this feature into HAProxy. > You are welcome to send a patch which add this feature. > > Maybe you could add "delete" into the > https://docs.haproxy.org/2.9/configuration.html#4.2-cookie function. > > Please take a look into > https://github.com/haproxy/haproxy/blob/master/CONTRIBUTING file if you plan > to contribute. > > > We have use cases where we want to delete cookies from the request. Not > > having this support in HAProxy also makes me question if one should be > > deleting request cookies in the reverse proxy layer. > > Maybe you can use some of the "*-header" functions to remove the cookie as > shown in the example in > https://docs.haproxy.org/2.9/configuration.html#4.4-replace-header
Lukas had already provided some fairly complete info on how to do it here: https://discourse.haproxy.org/t/best-way-to-delete-a-cookie/3184 Since then we've got the "replace-value" action that does the job for comma-delimited values, but sadly there's still this bogus syntax in the Cookie header where a semi-colon is used as the delimiter so replace-value cannot be used there. Requests for cookie removal are very rare but have always been present. I'm really wondering if we should implement a specific action for this instead of relying on replace-header rules. If adding 2-3 rules for these rare cases is not considered something too painful to maintain, I'd prefer it remains that way. If it comes at a cost (e.g. regex match) then maybe we'll need to think about it for 3.1. Regards, Willy