Forum Discussion
John_LeMay_1062
Nimbostratus
Apr 08, 2008Improving on this "catch all"?
Recently I configured a "catch all" type virtual server and I'm handling various aspects of traffic management with an iRule. So far it's working well, but it is already becoming difficult to manage. ...
hoolio
Cirrostratus
Apr 08, 2008The rule you have is actually pretty clean, if a bit hard to follow. You could use a switch statement with indentation and spacing instead. It might be a little easier to follow and slightly faster than multiple if/elseif/else's.
when HTTP_REQUEST {
Parse the HTTP host header value
switch [string tolower [HTTP::host]] {
Host was site1
site1.domain.com {
Set the pool to site1 pool
pool pool_site1.domain.com
}
Host was site2
site2.domain.com {
if {[HTTP::path] eq "/"}{
HTTP::uri "/pathtosite/site2"
}
if { [matchclass [IP::client_addr]/16 equals $::mySubnets] }{
pool pool_site2.domain.com_internal
} else {
pool pool_site2.domain.com
}
}
Host was site3
site3.domain.com {
pool pool_site1.domain.com
}
Unknown host, reset the connection
default {
reject
}
}
}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