Forum Discussion
mbohre_59527
Nimbostratus
Jun 01, 2010Forward HTTP request to different pools based on URI
I need help in creating a iRule that will forward the user request to appropriate pool based on URI.
For example, we have three sites www.xyz.com, www.abc.com, and www.test.com . All three sites resolves to VIP 10.10.10.10.
I need help in creating a iRule ( bind to VIP 10.10.10.10) to forward request for www.xyz.com to POOL1, www.abc.com to POOL2, and www.test.com to POOL3.
Thanks,
Mike
- Michael_Yates
Nimbostratus
This will do it for the [HTTP::uri]:when HTTP_REQUEST { switch -glob [string tolower[HTTP::uri]] { "/content1*" { pool pool.for.content1 } "/content2*" { pool pool.for.content2 } "/content3*" { pool pool.for.content3 } default { HTTP::redirect http://[getfield [HTTP::host] ":" 1]/content1 } } }
- hoolio
Cirrostratus
You could also use HTTP classes for this in 9.4.0+ and avoid an iRule. Create one HTTP class per pool, customise the Host header filter to look "www.xyz.com", select the action of "send to pool" and set the corresponding pool. For default pool selection, you can add a final HTTP class with no filters enabled which selects the "default" pool. Then add the HTTP classes to the virtual server under the Resources tab. - mbohre_59527
Nimbostratus
Thanks. This rule is perfectly working without any issues. - Chris_Gordon_14
Nimbostratus
Hey guys, I'm trying to do something very similar. I saw your iRule example, tried it, but I'm getting a sysntax error: - hoolio
Cirrostratus
Hi Chris,when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/start*" { pool zero-new_http-pool } default { pool zero_http-pool } } }
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