Forum Discussion
Mike_62127
Mar 13, 2018Nimbostratus
iRule catch all - to redirect if no pool selected
Hi I have multiple VS's setup (~150) that use an iRule to select the appropriate pool based on host header (no default pool assigned in VS config), this is working fine. I have been tasked wi...
Stanislas_Piro2
Mar 13, 2018Cumulonimbus
You can change your irules like that
Pool_Selection_iRule:
when HTTP_REQUEST {
HTTP::host [string tolower [HTTP::host]]
catch { pool "[HTTP::host]_pool"}
}
Sorry_Page_iRule:
when HTTP_REQUEST priority 900 {
set dpool [LB::server pool]
if { $dpool equals "" } { HTTP::redirect "http://sorry_page.com" ; unset dpool; return}
if { [active_members $dpool] == 0 } { HTTP::redirect "http://sorry_page.com"; unset dpool; return}
unset dpool
}
when LB_FAILED {
log -noname "[virtual name] DEBUG: Server Pool: $PoolName SELECTED"
if { [active_members [LB::server pool]] == 0 } {
log -noname "Sorry Page Activated / Server Pool: $PoolName selection failed on connection attempt from [IP::client_addr]"
HTTP::redirect "http://sorry_page.com"
}
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