Forum Discussion
Shlairshe_84486
Nimbostratus
Apr 25, 2014url redirect with rewrite capability
This is what should happen, when a user types http://bearcub.dev.leo.world.com/lookout the resulting website should be http://lion.dev.leo.world.com/lookout. but the client wants the resulting ur...
Apr 25, 2014
Assuming that the page is on the same server all you'd need is to change the uri before passing it forward:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set uri [string tolower [HTTP::uri]]
if { $host equals "lion.dev.leo.world.com" and $uri equals "/lookout" } {
HTTP::header replace Host "bearcub.dev.leo.world.com"
}
}
Now, if there's any images, stylesheets ets below /lookout that needs to be loaded you might be better off by using this:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set uri [string tolower [HTTP::uri]]
if { $host equals "lion.dev.leo.world.com" and $uri starts_with "/lookout" } {
HTTP::header replace Host "bearcub.dev.leo.world.com"
}
}
If the other bearcub.dev.leo.world.com resides on another server you will want to add a pool decision as well:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set uri [string tolower [HTTP::uri]]
if { $host equals "lion.dev.leo.world.com" and $uri starts_with "/lookout" } {
HTTP::header replace Host "bearcub.dev.leo.world.com"
pool bearcub_pool
}
}
/Patrik
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