Forum Discussion
Hannes_Rapp_162
Nacreous
I have done a lot of maintenance page stuff with F5, and from my experience, it's always better to issue a redirect to external splash page service instead of responding with static iFile object (HTML page) from F5 itself. Problem with static iFiles is that you will have to keep them updated manually yourself whereas with an external splash page service, you can give full control to your application/release team(s).
You can refer to my own solution and modify this as needed. Let me know if you have any questions.
Consider iRule execution priority if you have other iRules to avoid TCL errors (multiple redirect/response invocation type errors in particular).
Also consider general execution order. For instance, if you use mobile-user redirect iRules (which take end-users to another service), it would not make sense to display splash page to them, therefore, you should reduce the priority of a mobile-redirect iRule to 299 or less to make sure it's executed before this iRule.
priority 300
when HTTP_REQUEST {
Change value to 1 to manually force maintenance page redirect/response.
set manualSplash 0
Do not modify this setting
set splashBypass "false"
if { ([class match [IP::client_addr] equals "data_ip_maintenance_bypass"]) } {
Data-group: data_ip_maintenance_bypass includes IP addresses of company offices, and external collaborators responsible for functional release testing and validation. A splash page redirect/response will be suppressed for them at all times.
set splashBypass "true"
} elseif { ( [HTTP::header value "Via"] contains "llnw" ) || ( [HTTP::header value "Via"] contains "akamai" ) }{
Splash page redirect/response should be suppressed in case of CDN requests too. (You can remove this elseif section if you do not use CDN)
set splashBypass "true"
}
if { (( [active_members [LB::server pool]] < 1 || $manualSplash == 1) && ( $splashBypass == "false" )) } {
Redirect to splash page service, or respond with a static iFile object (HTML splash page) from F5.
Comment out 302 code response for a splash redirect, else comment out 200 code response for bigip iFile object response
Note that it's always better to execute redirect to a dedicated splash-page service
HTTP::respond 302 location "http://splash.mydomain.com/out-of-service" Cache-Control no-cache Connection Close
HTTP::respond 200 content [ifile get splash.html] "Content-Type" "text/html" Cache-Control no-cache Connection Close
event disable
}
}
Hannes_Rapp_162
Mar 29, 2016Nacreous
Another consideration with splash/maintenance page hosting in iFiles is that if your HTML page contains any images, they must be stored in BigIP LTM in encoded format (i.e. as base64 encoded strings). You can read more here: https://devcentral.f5.com/questions/base64-encoding-decoding