Forum Discussion
Blake_Traister2
Nimbostratus
Apr 08, 2009Choose pool based on URL (filename extension)
I have built 3 pools and need to choose the pool on the following criteria:
Port Redirection
IF (URL == /.asp) || (URL == /.css) || (URL == /.aspjs) || (URL == /.htc) || (URL == /.aspxml) || (URL == /.aspxsl) || (URL == /*.html)
GOTO port 6002
IF (URL == /*.svc)
GOTO port 7006
IF NONE OF THE ABOVE
GOTO Port 6102
My Irule which seems VERY ugly to me:
when HTTP_REQUEST {
if {[HTTP::uri] contains ".asp"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".css"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".aspjs"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".htc"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".aspxml"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".aspxsl"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".html"} {
pool stage.cmr.yellowpages.com_6002
} elseif {[HTTP::uri] contains ".svc"} {
pool stage.cmr.yellowpages.com_7006
} else {
pool stage.cmr.yellowpages.com
return
}
log local0.info
}
Additionally, I would like to redirect to a different VIP if all 3 pools are down...
1 Reply
- c_p_i_o_17707Historic F5 Account1. You can use a "switch" statement to instead of "if/else" to make it cleaner. It seems like 6002 pool would probably be under the default statement.
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