Forum Discussion
Puli
Nimbostratus
Aug 17, 2010re-direct a URL but maintain the same URL in browser
i have a requirement as below.
From URL : http://serverA.com/eng/test.hml
This need to be re-directed or re-written to
To : http://serverA.com/global/eng/test.html ...
Moe_Jartin
Cirrus
Aug 24, 2010Puli,
One other thing. I think the reason you are seeing the uri change in the browser is because even though you are rewriting the request, you are NOT rewriting the responses. Look at the HTTP headers (using something like LiveHTTP Headers for FireFox) and you will see that the responses from the server are sending your browser to the new uri WITH the /global. Try this:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/eng"}{
HTTP::path "/global[HTTP::path]"
}
}
when HTTP_RESPONSE {
Remove inserted path from HTTP responses
if { [HTTP::is_redirect]}{
HTTP::header replace Location [string map -nocase {"/global" ""} [HTTP::header Location]]
} elseif {
[HTTP::header value "Content-Type"] contains "text"} {
STREAM::expression "@/global@@"
STREAM::enable
} else {
STREAM::disable
}
}
This will insert /global to each of the requests and remove it from the responses. You will need to add a generic stream profile to the VIP but I think it will give you what you are looking for.
Joe Martin
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