Nice one stjbrown. You could add a sanity check that the path doesn't already have the string as well.
Joshua, do you want to append /sc/pol to the HTTP path (/path/to/file.ext) or the URI (/path/to/file.ext?param1=value1¶m2=value2)?
Here is an example of the first option:
when HTTP_REQUEST{
if {[HTTP::host] contains "test" and not ([HTTP::path] ends_with "/sc/pol") }{
Due to a bug in v10.0 - 10.2.1, HTTP::path truncates the HTTP query string if present.
This is described in CR142756. This should be fixed in 10.2.1HF1.
Check if there is a query string
if {[HTTP::query] eq ""}{
No query string, so append the string to the path
HTTP::uri "[HTTP::uri]/sc/pol"
} else {
Append the string to the path and re-append the query string
HTTP::uri "[HTTP::path]/sc/pol?[HTTP::query]"
}
}
}
And an example of the second option:
when HTTP_REQUEST{
if {[HTTP::host] contains "test" and not ([HTTP::uri] ends_with "/sc/pol") }{
HTTP::uri "[HTTP::uri]/sc/pol"
}
}
Aaron