In this case the user wants to change the uri of a HTTP request without forcing a redirect from the client.

We have a unique situation where a client-based DLL is uploading a file to our website. For reasons beyound my control I need to change the destination url without a redirect. When I use a redirect the payload (file to upload) is lost because the DLL is not smart enough to resubmit file for upload.

This can be done with the HTTP::uri command fairly easily. The fun starts with how you go about doing it.

Let's say you want to replace the entire URI with something new. For this example, let's say we need to replace "/foo" with "/bar". This can be done by the following:

when HTTP_REQUEST {
   if { [HTTP::uri] equals "/foo" } {
      HTTP::uri "/bar"
   }
}

But, what happens if you are working with a URI containing get parameters? This way you only know the beginning of the uri. Again, no problem. In this example the following iRule will replace any uri starting with "/foo" with "/bar"

when HTTP_REQUEST {
   if { [HTTP::uri] starts_with "/foo" } {
      HTTP::uri "/bar[string range $uri 4 end]"
   }
}

-Joe

[Listening to: Nookie - Limp Bizkit - Significant Other (04:50)]