Forum Discussion

Techgeeeg_28888's avatar
Techgeeeg_28888
Icon for Nimbostratus rankNimbostratus
Apr 13, 2012

Redirecting user request to maintenance page or another Virtual Server

Hi Everyone,

 

Alot you must have faced this requirement in your environment so I really need someone to help me out in this. I have a virtual server where I want to configure that in case if all of the pool members are down the users should get redirected to the maintenance page, if certain no. of pool members are down users should get redirected to the server busy page. Also if there is a possibility to redirect the user request to another virtual server in case if the no. of requests on a currently working virtual server exceeds by certain value.

 

 

Regards,

 

 

 

2 Replies

  • in case if all of the pool members are down the users should get redirected to the maintenance page, if certain no. of pool members are down users should get redirected to the server busy page.i think active_members could be usable. can you try?

     

     

    active_members wiki

     

    https://devcentral.f5.com/wiki/iRules.active_members.ashx

     

     

    Also if there is a possibility to redirect the user request to another virtual server in case if the no. of requests on a currently working virtual server exceeds by certain value.are these helpful?

     

     

    iRule::ology - Table Based Rate Limiting by Colin

     

    https://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086416/iRuleology--Table-Based-Rate-Limiting.aspx

     

     

    virtual wiki

     

    https://devcentral.f5.com/wiki/iRules.virtual.ashx
  • I did this recently, using the following irule named "failwhale-irule":

    
    when HTTP_REQUEST {
        if { [class match [virtual name] equals "failwhale-maintenance"] } {
            log -noname local0. "MAINT [HTTP::host] [HTTP::uri] VS [virtual name] is in maintenance"
            pool maintenance_pool
            snat automap
        }
        if { [class match [LB::server pool] equals "failwhale-maintenance"] } {
            log -noname local0. "MAINT [HTTP::host] [HTTP::uri] POOL [LB::server pool] is in maintenance"
            pool maintenance_pool
            snat automap
        }
        if { [active_members [LB::server pool]] == 0} {
            log -noname local0. "FAIL [HTTP::host] [HTTP::uri] [LB::server pool] has no active members"
            pool failwhale_pool
            snat automap
        }
    }
    
     can also use when LB_FAILED with LB::reselect
    

    maintenance_pool and failwhale_pool point to http servers where the default site is an Apache server accepting any Host: header. It runs a WSGI script that customizes a maintenance or failure page with the requested site name and URL.

    In this case I'm using snat automap because the pool members happen to be external, making it a one-armed setup.

    if { [active_members [LB::server pool]] == 0} is what you're really asking for, but I thought you might also be interested in the capability of class matching to virtuals that are known to be in maintenance. This lets us configure a site for maintenance without making it look like it's down accidentally.