Forum Discussion
iRule for App Offline
There is a way to do it but you need to make sure you follow the config as follow The pool name have to be in lower case and equal to the domain name. This is because we are getting the Header from the request and change it to lower case In this Irule, I am adding the word pl_ but you can remove it Example Http or https://abc.123.com the pool name have to be abc.123.com
when HTTP_REQUEST {
set the host name and url to lower caseset Vuri [ string tolower [HTTP::uri]] set Vheader [string tolower [HTTP::host]]
set the Poolname variable.set Poolname "$Vheader"
set the default site name variableset SiteName "XXXX.MAINTENANCEPAGE.org"
set Irulename "Irule_$SiteName" set SiteRedirect "https://$SiteName"
Obtain active poolmembers count and listset Poolmember [active_members $Poolname ] set Poolmemberlist [ active_members -list $Poolname]
if {$Poolmember < 1} then {
log local0.alert "ALERT-TEAM Pool $Poolname is down. This mean $SiteName website is down. IRULE=$Irulename";
HTTP::redirect "http://www.YOURPAGE-OFFLINE.COM"
}
pool $Poolname
}
- Hectorm_262752Aug 18, 2017Cirrus
when HTTP_REQUEST { set the host name and url to lower case set Vuri [ string tolower [HTTP::uri]] set Vheader [string tolower [HTTP::host]] set the Poolname variable. set Poolname "$Vheader" set the default site name variable set SiteName "XXXX.MAINTENANCEPAGE.org" set Irulename "Irule_$SiteName" set SiteRedirect "https://$SiteName" Obtain active poolmembers count and list set Poolmember [active_members $Poolname ] set Poolmemberlist [ active_members -list $Poolname] if {$Poolmember < 1} then { log local0.alert "ALERT-TEAM Pool $Poolname is down. This mean $SiteName website is down. IRULE=$Irulename"; HTTP::redirect "http://www.YOURPAGE-OFFLINE.COM" } pool $Poolname }
- Hectorm_262752Aug 18, 2017Cirrus
Let me know if this works for you
- rwagner1Aug 22, 2017Nimbostratus
Can I replace the HTTP::redirect "; with HTTP::respond 200 content [ifile get App_Offline]
- rwagner1Aug 22, 2017Nimbostratus
I'm really new to iRules and I'm not sure what the set SiteName "XXXX.MAINTENANCEPAGE.org" references. Why would I have a default SiteName if I'm using host headers?
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