Dear all,
I want to rewrite a query string, for example:
from http://www.haproxy.cm/dv=1234&cv=5.3.0
to http://www.haproxy.cm/dv=1234&cv=5.0.1
I’ve created rule, but it didn’t as expected. Here is the rule:
reqirep ^([^\ ])\ &cv=5.3.0(.) \1\ &cv=5.0.1\2
Can you guys help me check if I miss anything?
Thanks for your help.
Hi yanggis -
This might be an easier config if you’re trying to just replace the one query variable:
http-request set-query %[query,regsub(cv=5.3.0,5.0.1,g)]
Hope that helps!
Hi ahayworth,
Thanks for your reply. It worked.
Thanks lot ahayworth for the answer. I have list of numbers which needs to be replaced with the corresponding mapped number. Sample map file is below:
5.3.0 5.0.1
3.3.0 3.0.1
4.3.0 4.0.1
How I can replace number from the mapped file. Example:
from http://www.haproxy.cm/dv=1234&cv=5.3.0
to http://www.haproxy.cm/dv=1234&cv=5.0.1
from "http://www.haproxy.cm/dv=1234&cv=3.3.0"
to “http://www.haproxy.cm/dv=1234&cv=3.0.1”