Forum Discussion
Richard_K_20123
Nimbostratus
Aug 19, 2015iRule - A lot of urls with single VIP
Hi gents
I need to create a iRule for multiple urls with single VIP.
Could you please let me get your knowledge?
The following is the URL structure.
*.(application)-(environment).test....
Chad_P_17647
Nimbostratus
Aug 22, 2015Richard,
Like Michael said you can you policies in 11.4 and up.
https://support.f5.com/kb/en-us/solutions/public/15000/000/sol15085.html
In an iRule you can do it many ways but using the switch is cleaner and will be more efficient. Something like:
when HTTP_REQUEST {
set http_host [string tolower [HTTP::host]]
set pool1 "poola"
set pool2 "poolb"
set pool3 "poolc"
set default "default_pool"
switch -glob [$http_host] {
"*.test.a.com" {
pool $pool1
}
"*.test.b.com" -
"b.com" {
pool $pool2
}
"www.c.com" {
pool $pool3
}
default {
pool $default
}
}
}
Switch: https://devcentral.f5.com/articles/irules-101-04-switch
-Chad
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