Forum Discussion
fasteddye
Nimbostratus
Feb 22, 2019redirect that also appends uri
We have some web servers behind a VIP that host several sites and use an irule for redirects to proper web site. We are adding a 3rd site that to these web servers and it requires a little bit of a ...
Samir_Jha_52506
Noctilucent
Feb 23, 2019Prepared as per above comments. Try below iRule, Hope It will solved issue.
when HTTP_REQUEST {
if { ([HTTP::host] equals "web1.abc.com") && ([HTTP::uri] == "/") }
{ HTTP::redirect "https://web1.abc.org/web1" }
elseif { ([HTTP::host] equals "web1.web.abc.com") && ([ HTTP::uri] == "/") }
{ HTTP::redirect "https://web1.web.abc.com/web" }
elseif { ([HTTP::host] equals "web2.abc.com") && ([ HTTP::uri] == "/") }
{ HTTP::redirect "https://web2.abc.com/file_path[HTTP::uri]" } }
OR
when HTTP_REQUEST {
if { [HTTP::uri] equals "/"} {
switch [string tolower [HTTP::host]] {
"web1.abc.com" {HTTP::redirect "https://web1.abc.org/web1" }
"web1.web.abc.com" {HTTP::redirect "https://web1.web.abc.com/web" }
"web2.abc.com" {HTTP::redirect "https://web2.abc.com/file_path[HTTP::uri]"}
}
}
}
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