Forum Discussion
hooleylist
Sep 28, 2009Cirrostratus
stjbrown, the value for HTTP::uri and most other HTTP:: commands is cached within the same iRule event. You can see the updated value by adding a second HTTP_REQUEST event with a priority that triggers after the defautl priority of 500:
when HTTP_REQUEST {
set query_args "p1=v1"
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
if { [HTTP::uri] ends_with "?" } {
http://www.foo.com/bar? -> http://www.foo.com/bar?p1=v1
HTTP::uri "[HTTP::uri]$query_args"
} elseif { [HTTP::uri] contains "?" } {
http://www.foo.com/bar?a=b -> http://www.foo.com/bar?a=b&p1=v1
HTTP::uri "[HTTP::uri]&$query_args"
} else {
http://www.foo.com/bar -> http://www.foo.com/bar?p1=v1
HTTP::uri "[HTTP::uri]?$query_args"
}
}
when HTTP_REQUEST priority 501 {
log local0. "[IP::client_addr]:[TCP::client_port]: (501) Updated URI: [HTTP::uri]"
}
Aaron