Forum Discussion
MeAndMyBIGIP_60
Nimbostratus
Jun 21, 2010HTTP::URI redirect to another Pool
Trying to use the sample code here (http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__uri.html) to do something that should be very simple: when HTTP_REQUEST {
if { [HTTP::uri] ends...
hoolio
Cirrostratus
Jun 21, 2010You could add logging to see exactly what's happening. You can also use a switch statement if you plan on adding more cases to the iRule:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
switch -glob [HTTP::uri] {
"*content1" {
pool content_pool_1
log local0. "[IP::client_addr]:[TCP::client_port]: matched content1. Pool: [LB::server]"
}
"/abc*" {
pool abc_servers
log local0. "[IP::client_addr]:[TCP::client_port]: matched abc. Pool: [LB::server]"
}
default {
log local0. "[IP::client_addr]:[TCP::client_port]: default. Pool: [LB::server]"
log local0. "No match"
}
}
}
when SERVER_CONNECTED {
Debug logging only. Remove this event once done testing
log local0. "[IP::client_addr]:[TCP::client_port]: server: [LB::server], [IP::server_addr]:[TCP::server_port]"
}
You'll probably want to add a OneConnect profile to the VS any iRule that selects a pool only in some cases to ensure that a load balancing decision is honored for each HTTP request instead of once per clientside TCP connect. If you're using SNAT you can use the default 0.0.0.0 source mask OneConnect profile. If you're not using SNAT, you should create a custom 255.255.255.255 source mask OneConnect profile to keep the source IP address accurate on serverside connections. See these OneConnect articles for details:
http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/oneconnect.html
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=114
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