Nicola_DT
Aug 20, 2009Nimbostratus
irule for rewriting an uri in an http request
Hi everyone,
I am writing a simple irule so that if an http request will arrive on the virtual with an uri that starts with "/config" the request will be passed to the pool rewrited and the url "/config" must be replaced by "/main".
The irule 'should' work:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/config"} {
set HTTP::uri /main
}
}
Issus is I do not know if the Bigip has to re-substitute the uri in the response to the client, for that I'd add something like:
when HTTP_RESPONSE
if { [HTTP::uri] starts_with "/main" } {
set HTTP::uri /config}
}
But this second part of the irule gives me errors:
01070151:3: Rule [aaa] error:
line 1: [wrong args] [when HTTP_RESPONSE ]
line 3: [command is not valid in the current scope] [if { [HTTP::uri] starts_with "/main" } {
set HTTP::uri /config} ]
line 7: [command is not valid in the current scope] [}]
Any Tip on how to fix this easy uri rewriting issue ?
Thanx,
Nicola.