Forum Discussion

  • 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.

  • Hi Michael,

     

    is it when HTTP_REDIRECT

     

    or

     

    when HTTP_REQUEST

     

    Because "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" } }]

     

  • 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"
        }
    }    
    
  • 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" } }

     

  • 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
    -glob
    allows the use of wildcards (the
    *
    character). So in this case, anything starting with
    /images/
    will be caught in that condition.

    when HTTP_REQUEST { 
        switch -glob [string tolower [HTTP::uri]] {
            "/maintenance.html" -
            "/images/*" {
                 Do nothing. These are exceptions
                return
            }
            default {
                HTTP::redirect "/maintenance.html"                 
            }
        } 
    }