Forum Discussion

EL's avatar
EL
Icon for Nimbostratus rankNimbostratus
Mar 16, 2017

Automatic Maintenance Page

Hi Folks

 

I would like to check whether got any sample irule to achive my requirement. I would like enable the automatic maintenance page if my server under maintenance, the requirement as below if f5 monitor certain file and return with 1, it will redirect to maintenance page 1 and if return with 2 it will redirect to maintenance page 2 but if never response or return anything it will do nothing so means no under maintenance

 

thanks

 

2 Replies

  • You can use something like this:

    When HTTP_REQUEST {
    if { [active_members pool_name] < 1 } {
    HTTP::respond 302 Location "http://domain.com/maintenance.html"
    }
    }
    

    There are multiple variations of this in devcentral. A search online should help. Also, fallback host in HTTP profile can also be used.

  • Hi,

    You need to create 3 load balancing pools.

    1 pool that has a generic http monitor and is used for traffic processing.

    1 pool with a monitor with a disabled string 1 and pool name pool_1 (this pool won't process traffic)

    1 pool with a monitor with a disabled string 2 and pool name pool_2 (this pool won't process traffic)

    Your irule will look like:

    When HTTP_REQUEST {
        if { [active_members pool_1] < 1 } {
            HTTP::respond 302 Location "http://domain.com/maintenance_1.html"
        } elseif { [active_members pool_2] < 1 } {
            HTTP::respond 302 Location "http://domain.com/maintenance_1.html"
        }    
    }
    

    Cheers,

    Kees