Deon
Jun 13, 2008Nimbostratus
How to change the uri in a request?
Hi. I am a brand new to writing iRules here and this seems like it should be easy but I can't see what my problem is. I am trying to rewrite the uri and remove a path before I send the request along to a different than default pool for this virtual server. I will also need to be changing the header but have not gotten that far yet.
Here is my rule so far:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/ImageMetaData/" }{
log local0. "matched string"
log local0. "host= [HTTP::host]"
log local0. "uribefore= [HTTP::uri]"
HTTP::uri "substr [HTTP::uri] 14"
HTTP::uri "/blahblahblah"
log local0. "uriafter= [HTTP::uri]"
pool DEV_Image_Access_Service
}
}
I was not able to get the uri reassignment to happen on the line with the substr. I then decided to just specify a value "/blahblahblah". To my dismay I appear to not be able to assign a value to HTTP::uri. The log file is showing me...
Jun 13 15:44:08 tmm tmm[864]: Rule Image_Access_Rewrite : matched string
Jun 13 15:44:08 tmm tmm[864]: Rule Image_Access_Rewrite : host= dev.systemx.mycompany.net
Jun 13 15:44:08 tmm tmm[864]: Rule Image_Access_Rewrite : uribefore= /ImageMetaData/authenticate?appId=spectrum
Jun 13 15:44:08 tmm tmm[864]: Rule Image_Access_Rewrite : uriafter= /ImageMetaData/authenticate?appId=spectrum
Thanks
-deon