Forum Discussion
Content Switching for URL using iRule and different Pools
I am trying to create a basic iRule to switch content. I am using single Vserver and need to switch content for 2 different Http URL's using 2 different pools with associated backends servers.
URL1. "abc.com" URL2. "xyz.com"
URL1 needs to use Pool1 and url2 needs to use Pool2.
Looking at some of your previous questions, I created the below iRule. Can anyone please confirm if this is accurate or something needs to be changed.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] { "abc.com" { pool pool_1} "xyz.xom" { pool pool_2} } }
- RossVermette
Nimbostratus
How about something like this,
Create a DataGroup to map "host header names" to Pool mappings. example HOST2POOL_DG
"abc.com" := "POOL01",
"xyz.com" := "POOL02",
when HTTP_REQUEST { set pool_select_value [class lookup [string tolower [HTTP::host]] HOST2POOL_DG] pool $pool_select_value }
or
simple irule:when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "abc.com" { pool POOL01} "xyz.com" { pool POOL02} } }
Recent Discussions
Related Content
* 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