Forum Discussion
Richard_Grigsby
Nimbostratus
Jun 03, 2015iRule to read URI then point to the desired pool
I have a requirement to read a URL where the host and port are static https:/// But the URI changes. Based on the URI, I need to load balance to a server pool answering tcp/8443 or tcp/8444, or tcp...
Scott_Hopkins
Nimbostratus
Jun 03, 2015Make sure you have oneconnect on for your virtual server. If not, it will only make a load balancing decision on the first message on a connection.
The iRule looks fairly good (although try to wrap in in a code block to display a little cleaner). This is a proper use of switch over if statements, although you may want to switch to [HTTP::Path] and wrap the HTTP::uri/path with a [string tolower] block to make sure case issues don't bugger this up. You may also want to look at the ProxyPass iRule for something that does this out of the box.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/ent-inventory-services" { pool pools_sss_dev_8443 }
"/ent-customer-services" { pool pools_sss_dev_8443 }
"/ent-security-services" { pool pools_sss_dev_8443 }
"/ent-payment-services" { pool pools_sss_dev_8443 }
"/ent-agreement-services" { pool pools_sss_dev_8443 }
"/ent-misc-services" { pool pools_sss_dev_8443 }
"/ent-ht-services" { pool pools_sss_dev_8444 }
"/customer" { pool pools_sss_dev_8445 }
"/inventory*" { pool pools_sss_dev_8445 }
"/agreements" { pool pools_sss_dev_8445 }
"/ent-exception-services" { pool pools_sss_dev_8445 }
"/payment" { pool pools_sss_dev_8445 }
"/ent-report-services" { pool pools_sss_dev_8445 }
default { Default - not matching any URI pool pools_sss_dev_default }
}
}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