Forum Discussion
walt_97468
Nimbostratus
Dec 02, 2008302 redirect string capture and replace
I have modified a previous post for this irule:
when HTTP_REQUEST {
HTTP::header replace "Host" "www.test.com"
}
when HTTP_RESPONSE {
HTTP::header repl...
walt_97468
Nimbostratus
Dec 05, 2008We fuinally resolved this with an http profile set to rechunk, a stream profile that is actually doing the rewrite and the following irule as this is the only way we were able to rewrite the content in the redirect:
when HTTP_REQUEST {
change host header
HTTP::header replace "Host" "www.test.com"
}
when HTTP_RESPONSE {
HTTP::header replace "Host" "www.test2.com"
if {[HTTP::is_redirect] && [HTTP::header location] contains "www.redirect.com"} {
set oldLoc [HTTP::header Location]
set newLoc1 [string trimleft $oldLoc http://www.redirect.com]
set newLoc [concat https://www.test2.com/$newLoc1]
HTTP::header replace Location $newLoc
}
}
We used extensive logging to determine when we had the correct URL and URI. It was a tough one. Thanks for everyone's assistance.
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