HAProxy 2.0 replace text in querystring


There is times when some JavaScript genius codes his program like this to check existence of a parameter in the Query String of a URL:

if (url.includes('&id=')) ...

And you are just a sysadmin who wants to stop your client for complaining his stupid plugin does not work… So, what you can do about it? If you are using HAProxy 2.0, there is a lot you can do!!

You can use the 'http-request set-query' directive:

http-request set-query %[query,regsub(id=,youare=stupid&id=,g)]


Hopefully you can do this, or either kill the JavaScript Genius with your own hands, it is up to you!