Forum Discussion
Maintenance URL by iRule
is it enough for Maintenance URL from abc.com..?
when HTTP_REQUEST { HTTP::redirect "http://www.abc.com/maintenance.html" }
7 Replies
- Michael_Jenkins
Cirrostratus
If you already have a maintenance.html page on the site, then I would use this
when HTTP_REDIRECT { if { not ([HTTP::uri] equals "/maintenance.html") } { HTTP::redirect "http://www.abc.com/maintenance.html" } }Otherwise, you would have an endless loop because it's not checking if you're already on that page.
If you want a iRule based maintenance page, the Codeshare page has some examples of that.
- siyadh_121603
Nimbostratus
Hi Micheal,
Thank you..please find updated
when HTTP_REQUEST { if { not ([HTTP::uri] equals "/maintenance.html") } { HTTP::redirect "http://www.abc.com/maintenance.html" } }
- siyadh_121603
Nimbostratus
Hi Michael,
is it when HTTP_REDIRECT
or
when HTTP_REQUESTBecause "when HTTP_REDIRECT" is not accepting. and error as below
Exception caught in LocalLB::urn:iControl:LocalLB/Rule::create() Exception: Common::OperationFailed primary_error_code : 17236305 (0x01070151) secondary_error_code : 0 error_string : 01070151:3: Rule [/Common/Maintenance_iRule_4] error: /Common/Maintenance_iRule_4:1: error: [unknown event (HTTP_REDIRECT)][when HTTP_REDIRECT { if { not ([HTTP::uri] equals "/maintenance.html") } { HTTP::redirect "/maintenance.html" } }]
- Michael_Jenkins
Cirrostratus
sorry. mistype... it's HTTP_REQUEST.
- Michael_Jenkins
Cirrostratus
Updated: The other option would just use the uri, which would look like this instead...
when HTTP_REDIRECT { if { not ([HTTP::uri] equals "/maintenance.html") } { HTTP::redirect "/maintenance.html" } } - siyadh_121603
Nimbostratus
we have made the below iRule and it is working...but images are blocking. images are in /images/
can we exclude images by conditions...?
when HTTP_REDIRECT { if { not ([HTTP::uri] equals "/maintenance.html") } { HTTP::redirect "/maintenance.html" } }
- Michael_Jenkins
Cirrostratus
Try this then. If you want to add more exceptions, just append them to the first set of URI checks (the
denotes an additional value is on the next line). The-
allows the use of wildcards (the-glob
character). So in this case, anything starting with*
will be caught in that condition./images/when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/maintenance.html" - "/images/*" { Do nothing. These are exceptions return } default { HTTP::redirect "/maintenance.html" } } }
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