Forum Discussion
jmeuse35_166730
Nimbostratus
Oct 22, 2014URL Rewrite - No redirection
A bit new to processing the irules and have a question which I hope the group can asisst with.
Scenario:
User URL: http://site.company.com/study1
F5 will rewrite the URL -> /ServiceStudyDB...
shaggy
Nimbostratus
Oct 22, 2014For rewriting redirect locations, check out https://devcentral.f5.com/articles/rewriting-redirects
jmeuse35_166730
Nimbostratus
Oct 22, 2014Ok got around it with the following:
when HTTP_REQUEST {
if {[HTTP::uri] contains "/study1"} {
HTTP::header remove "Accept-Encoding"
HTTP::header replace Location [string map -nocase {"study1" "ServicesStudyDB"} [HTTP::header Location]]
HTTP::uri "/ServicesStudyDB"
HTTP::uri [string map -nocase {"study1" "ServicesStudyDB"} [HTTP::uri]]
STREAM::disable
}
}
when HTTP_RESPONSE {
if {[HTTP::header Content-Type] contains "text"}{
set study1_uri [string map -nocase {"/ServicesStudyDB" "/study1"} [HTTP::header "Location"]]
HTTP::header replace Location $study1_uri
HTTP::header replace Location [string map -nocase {"ServicesStudyDB" "study1"} [HTTP::header Location]]
}
}
As there is content within the page that is referencing the /ServiceStudyDB virutal directory I will look at using a stream Irule to correct. Hoping this is easiest way.
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
