Forum Discussion
nitass
Apr 24, 2015Employee
e.g.
irule
[root@ve11c:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set uri [HTTP::uri]
if { [scan $uri {/%*[^/]/%[^/]%s} id rest] == 2 } {
set rest [string trimright $rest "?"]
if { $rest contains "?" } {
set newuri "${rest}&id=${id}"
} else {
set newuri "${rest}?id=${id}"
}
HTTP::uri $newuri
}
}
when HTTP_REQUEST priority 1000 {
log local0. "$uri > [HTTP::uri]"
}
}
test
[root@ve11c:Active:In Sync] config tail -f /var/log/ltm
Apr 24 22:50:02 ve11c info tmm1[5649]: Rule /Common/qux : /prefix/foo/ > /?id=foo
Apr 24 22:50:10 ve11c info tmm[5649]: Rule /Common/qux : /prefix/foo/path > /path?id=foo
Apr 24 22:50:16 ve11c info tmm1[5649]: Rule /Common/qux : /prefix/foo/path? > /path?id=foo
Apr 24 22:50:22 ve11c info tmm[5649]: Rule /Common/qux : /prefix/foo/path?p=7 > /path?p=7&id=foo