Forum Discussion
f5now_28704
Nimbostratus
Oct 22, 2007combining two redirect irules
He guys, I have two irules that I didnt know if I could make them in to one both are redirection.
1.
when HTTP_REQUEST {
if { [HTTP::uri] eq "/application.aspx" } {
HTTP::redirect "https://www.google.net/application.aspx"
}
}
2.
when HTTP_REQUEST {
if { [HTTP::host] equals "google.net" } {
HTTP::redirect "http://www.google.net[HTTP::uri]"
}
}
I tryied this...looks to work
when HTTP_REQUEST {
if { [HTTP::uri] eq "/application.aspx" } {
HTTP::redirect "https://www.google.net/application.aspx"}
else {
if { [HTTP::host] equals "google.net" } {
HTTP::redirect "http://www.google.net[HTTP::uri]"
}
}
}
is there a cleaner way for this or is this fine.
1 Reply
- hoolio
Cirrostratus
That looks fine. When including multiple redirects in a rule, or multiple rules for the same VIP, you just have to make sure that two redirects can't be issued for one HTTP request.
You can combine the else and the following if to simplify it:when HTTP_REQUEST { if { [HTTP::uri] eq "/application.aspx" } { HTTP::redirect "https://www.google.net/application.aspx" } elseif { [HTTP::host] equals "google.net" } { HTTP::redirect "http://www.google.net[HTTP::uri]" } }
Aaron
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