Forum Discussion
nitass_89166
May 19, 2014Noctilucent
e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set q [URI::query [HTTP::uri] query]
log local0. "q = $q"
if { $q eq "A" } {
log local0. "origin uri = [HTTP::uri]"
HTTP::uri [string map "query=$q query=B" [HTTP::uri]]
log local0. "new uri = [HTTP::uri]"
}
}
}
/var/log/ltm
[root@ve11a:Active:In Sync] config tail -f /var/log/ltm
May 18 21:32:58 ve11a info tmm[14715]: Rule /Common/qux : q = A
May 18 21:32:58 ve11a info tmm[14715]: Rule /Common/qux : origin uri = /URI?query=A&other=somethingelse
May 18 21:32:58 ve11a info tmm[14715]: Rule /Common/qux : new uri = /URI?query=B&other=somethingelse
- Moinul_RonyMay 27, 2014AltostratusThanks nitass, that works perfectly. But now I have a slightly different requirement matching on the incoming hostname (red.x.com) I would want to add a value such as code=red and replace anything else with code=red example: Case 1: code=yellow gets replaced with code=red https://red.x.com/test/find.jsp?dodgy=bla&class=XY&code=yellow&run=Y&state=QLD should change to https://red.x.com/test/find.jsp?dodgy=bla&class=XY&code=red&run=Y&state=QLD code=red value not present -> add to the end of the URI https://red.x.com/test/find.jsp?dodgy=bla&class=XY&run=Y&state=QLD should change to https://red.x.com/test/find.jsp?dodgy=bla&class=XY&run=Y&state=QLD&code=red