Forum Discussion

Sajid's avatar
Sajid
Icon for Cirrostratus rankCirrostratus
Jun 10, 2008

Redirect to Reponse Page on virtual server or monitoring port Down

Hi Guys

 

 

i am iRule for the following requirement.

 

 

"Redirect to Reponse Page on virtual server or monitoring port Down"

 

 

If VS is down, iRule should automatically to response page or URL.

 

 

Thanks

 

Sajid

7 Replies

  • You could probably handle the LB_FAILED event and use HTTP::respond to send a custom page back the client.

     

     

    Just saw this on codeshare, which might be helpful:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/LTMMaintenancePageLite.html

     

     

    Would that handle what you're looking for?
  • There is a known issue with using HTTP::redirect from the LB_FAILED event in some LTM versions:

     

     

    SOL7899: The iRule HTTP::redirect generates an error when it is used within the LB_FAILED event

     

    https://support.f5.com/kb/en-us/solutions/public/7000/800/sol7899.html

     

     

    Another option might be to configure a fallback host on the HTTP profile. LTM will issue a redirect to the client if no members in the pool are marked up. ahermans' suggestion would allow you to issue a redirect if a single request failed, which may be better for your requirements.

     

     

    Aaron
  • Sajid's avatar
    Sajid
    Icon for Cirrostratus rankCirrostratus
    Hello Guys

     

     

     

    i am going to try this one

     

     

     

    ***************************************************************

     

    when HTTP_REQUEST {

     

    if { 0 == [active_members [LB::server pool]] } {

     

    HTTP::redirect "http://my.domain.com/maintenance.html"

     

    }

     

    }

     

    ***************************************************************

     

     

     

    Thanks

     

    S.Ali

     

  • You could get the same functionality as that rule without a rule by configuring a fallback host of http://my.domain.com/maintenance.html in the HTTP profile associated with the VIP. For details on this, you can click the online help tab in the GUI when you're viewing the HTTP profile, or check AskF5.com.

     

     

    Aaron
  • I don't want to perform a redirect and want to retain the callers URL intact so I have a 'sorry server' pool of servers. My irule that seesms to work is:

     

     

    when HTTP_REQUEST {

     

    if { [active_members [LB::server pool]] == 0} {

     

    pool pool_HP_Sorry_Servers

     

    }

     

    }

     

     

    I tried to just use another form of this to just trigger on the failed LB

     

     

    when LB_FAILED {

     

    pool pool_HP_Sorry_Servers

     

    }

     

    But that doesn't work. Is there a way to trigger it via the LB_FAILED or is this because there is no HTTP_request active?

     

     

    Thanks.
  • Hi,

     

     

    What about trying LB::reselect pool $my_pool (Click here) instead of just the pool command in LB_FAILED?

     

     

    Aaron
  • Most excellent! This is slick and simple:

     

     

    when LB_FAILED {

     

    LB::reselect pool pool_HP_Sorry_Servers

     

    }