Forum Discussion
Danny_Trinh_197
Nimbostratus
Feb 04, 2009Better way to do if {...}
Hello,
I have the iRule below, it works; but I think there is a better way for my iRule. Can you give me a hint?
Thanks,
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "qipclient" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "qip.iss.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "qip" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "qipclient.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "qip.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "qipwebclient.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "qip-es.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "raildns.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "raildns" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
if { [string tolower [HTTP::host]] eq "raildns.iss.example.com" && [HTTP::path] eq "/" } {
HTTP::redirect "http://qip.example.com/qip"
}
}
- Deb_Allen_18Historic F5 Account
when HTTP_REQUEST { if { [HTTP::path] eq "/" } { switch [string tolower [HTTP::host]] { "qipclient" - "qip.iss.example.com" - "qip" - "qipclient.example.com" - "qip.example.com" - "qipwebclient.example.com" - "qip-es.example.com" - "raildns.example.com" - "raildns" - "raildns.iss.example.com" { HTTP::redirect "http://qip.example.com/qip" } } } } }
- Danny_Trinh_197
Nimbostratus
Thank you. It works great.
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