Forum Discussion
Fotios_30046
Nimbostratus
Nov 18, 2009Send Request To Pool If Certain HTTP_URI
I have a virtual server setup with a default pool. We have a third party appliance we want to use if anyone hits a certain subfolder of our site, www.site.com/products. There will probably be something after the products, so I need to rule to look for products and possibly anything after then send it to a different pool.
Here's what I have so far.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/products" } {
pool Appliance.
}
}
I don't need to make any changes to the virtual server except for adding this iRule, right?
- The_Bhattman
Nimbostratus
Hi Fotios,when HTTP_REQUEST { switch -glob [HTTP::uri] { "/products" { pool appliance } "/products/something" {pool something } "/products/something/andsomething" { pool andsomething } } }
- Fotios_30046
Nimbostratus
I don't need anything that advanced. Basically, we have a search appliance that we're adding to our site under /products. The only question I had was, what if the uri is longer than just /products, it will still be picked up by this iRule, right? - The_Bhattman
Nimbostratus
By making a small alteration in the irule you couldwhen HTTP_REQUEST { switch -glob [HTTP::uri] { "/products*" { pool appliance } } }
- Fotios_30046
Nimbostratus
One small wrinkle I found. If you're hitting the site under the /products* and you want to go back to the main site under the other pool, it doesn't seem to use that but rather stick to the appliance pool. Should I set the default pool, then change it based on the uri? Or could I reset the connection somehow? - hoolio
Cirrostratus
You should either explicitly set a pool for every case in the iRule if you're selecting a pool for any case, or add a OneConnect profile. See this post for details/testing examples: - Fotios_30046
Nimbostratus
Aaron, that post addressed my problem perfectly.
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