you may also try HTTP::query. HTTP::query writing data is introduced in 11.5.0.
ID385615 - RFE: Make HTTP::query iRule command support writing data
e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when RULE_INIT {
set static::qry_name "mykey"
set static::qry_value "myvalue"
}
when HTTP_REQUEST {
log local0. "origin=[HTTP::uri]"
set tmp [string map [list $static::qry_name=[URI::query [HTTP::uri] $static::qry_name] ""] [HTTP::query]]
set tmp [string map {&& &} $tmp]
set tmp [string trimleft $tmp &]
HTTP::query $tmp
HTTP::uri [string trimright [HTTP::uri] ?&]
log local0. "new=[HTTP::uri]"
}
}
test
[root@ve11a:Active:In Sync] config tail -f /var/log/ltm
Jun 8 11:09:21 ve11a info tmm[9801]: Rule /Common/qux : origin=/myuri
Jun 8 11:09:21 ve11a info tmm[9801]: Rule /Common/qux : new=/myuri
Jun 8 11:09:38 ve11a info tmm1[9801]: Rule /Common/qux : origin=/myuri?mykey=myvalue
Jun 8 11:09:38 ve11a info tmm1[9801]: Rule /Common/qux : new=/myuri
Jun 8 11:09:44 ve11a info tmm[9801]: Rule /Common/qux : origin=/myuri?mykey=myvalue&otherkey=othervalue
Jun 8 11:09:44 ve11a info tmm[9801]: Rule /Common/qux : new=/myuri?otherkey=othervalue
Jun 8 11:09:54 ve11a info tmm1[9801]: Rule /Common/qux : origin=/myuri?otherkey=othervalue&mykey=myvalue
Jun 8 11:09:54 ve11a info tmm1[9801]: Rule /Common/qux : new=/myuri?otherkey=othervalue
Jun 8 11:10:03 ve11a info tmm[9801]: Rule /Common/qux : origin=/myuri?otherkey=othervalue&mykey=myvalue&anotherkey=anothervalue
Jun 8 11:10:03 ve11a info tmm[9801]: Rule /Common/qux : new=/myuri?otherkey=othervalue&anotherkey=anothervalue