Forum Discussion
IRULE to redirect the traffic to a under_maintenance.htm
Hi,
I would like to know how to setup an IRule which will redirect all the HTTP/HTTPS traffic to URL(say under_maintenance.htm) when we make websites down for maintenance activities.
Also, in case of case of NLB with 2 NODES. where both nodes are down then how to redirect the traffic to a custom page.
3 Replies
- Matt_Dierick
Employee
https://devcentral.f5.com/wiki/irules.ltmmaintenancepage.ashx
https://devcentral.f5.com/wiki/iRules.LTMMaintenancePageLite.ashx
- Kevin_Stewart
Employee
There are a few additional options to consider:
-
Fallback Host: Inside the HTTP profile is an option called Fallback Host. This option, when defined, will send a 302 redirect to the specified address if all pool members are down. No iRules needed.
-
active_members check: a simple active_members check of the pool and then whatever you need to happen if all members are down:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { if { [active_members $default_pool] < 1 } { send a redirect or output HTML content here } } -
Time-based outage: based on the following post:
https://devcentral.f5.com/questions/irule-to-disable-a-pool-to-new-connections
when RULE_INIT { set static::START_OFF_TIME "Saturday 09:00 AM" set static::END_OFF_TIME "Saturday 11:00 AM" } when HTTP_REQUEST { set start_off_time [clock scan $static::START_OFF_TIME] set end_off_time [clock scan $static::END_OFF_TIME] set now [clock seconds] if { ( [expr $now > $start_off_time] ) and ( [expr $now < $end_off_time] ) } { HTTP::respond 200 content "Maintenance ModeMaintenance mode..." } }
-
- Arie
Altostratus
Since the Fallback Host generates a 302 (possibly followed by a 200) this could do bad things to SEO. A 503 (Service Unavailable) would be preferable in many cases.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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