Forum Discussion
Thomas_Uczekaj_
Nimbostratus
Jun 07, 2006Can you hide a URI change from client
Here is the sample Irule:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/"} {
HTTP::uri /stuff }
}
It does this:
client submits: http://host.testing.com
client receives: http://host.testing.com/stuff/index.htm
This is what we want it to do:
client submits: http://host.testing.com
client receives: http://host.testing.com/index.htm
Anyone have an idea how to do that (hide the change in the URI)?
Tom
7 Replies
- Thomas_Uczekaj_
Nimbostratus
What I'm looking for is the ability to change the URI on the Response, however, HTTP::uri only works on HTTP_REQUEST not for HTTP_RESPONSE - Deb_Allen_18Historic F5 Account
If you are re-writing the URI inbound, and wish to hide the change from the client, no changes to the HTTP response should be necessary.
If instead you want to re-write all the links on the page in HTTP_RESPONSE, exposing the new hostname and URI to the client on subsequent requests, you can use regsub & HTTP::payload replace against the response. (See the 2nd example on the HTTP::payload wiki page here: Click here)
HTH
/deb - bl0ndie_127134Historic F5 AccountIf you are using 9.2 or later version, the use of HTTP::payload should be depricated in favor of the stream profile which is more powerful and much more efficient. Read all about it here Click here
- Deb_Allen_18Historic F5 AccountSupport recently informed me of a known issue with the stream profile: The stream profile apparently does not update the Content-Length to the new size of the resulting content.
Until that's corrected, I've been avoiding the stream profile for replacements where the content length will change.
/deb - Colin_Walker_12Historic F5 AccountI don't believe uczekajt is looking for content re-writing, just URI re-writing from the client's perspective.
In which case you'd do something to the effect of:when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::uri "/stuff" } } when HTTP_RESPONSE { if { [HTTP::header location] contains "/stuff" } { set newLoc [string map {/stuff /} [HTTP::header location] ] HTTP::header replace location "$newLoc" } }
This would, of course, require re-writing each request and response.
Colin - Deb_Allen_18Historic F5 Accountsorry, I forgot there was a cross-post. Issue further discussed & resolved here:
/deb - Deb_Allen_18Historic F5 AccountAlso, apparently the workaround for the Content-Length update issue with the stream profile is to enable response chunking to rechunk in the http profile.
/deb
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects