Forum Discussion

Siddharth_Sezhi's avatar
Siddharth_Sezhi
Icon for Nimbostratus rankNimbostratus
Sep 21, 2006

Redirecting to a webpage when all the health check fails to the memerbs o the pool

Hi,

 

 

One of our customer is asking to setup a http redirection to a html page mentioned by them only if the health check fails to all members of the pool which are serving their website.

 

 

Their primary concern is due to outage when users hit their website they dont want to see the "page not found" instead they wanted to redirect to a url mentioned by them and this should happen only if the health check to all the members in the pool fails.

 

 

Please suggest me how to go abt with this request.

 

 

thank you

8 Replies

  • Hi

     

     

    I would try this quite simple iRule :

     

     

    when LB_FAILED {

     

    HTTP::redirect http://192.168.1.150/sorry.html

     

    }

     

     

    Fred

     

  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account
    Please also check this post. BTW, the problem mentioned on that thread has already been fixed and will be available on the release (v9.4) which should be coming out soon. Click here
  • Is there any reason to not just use the fallback host option in the HTTP profile?

     

     

    I suppose triggering the redirect on LB_FAILED ensures that the client will be redirected on any connection that fails as opposed to waiting for the monitors to mark all nodes down. Though in theory, the request is what the fallback host was designed for.

     

     

    Aaron
  • LB Failed option wil redirect to a new pool if the LB couldnt get to the pool. My requirement says that when the httpd daemon stops running the server or the servers in the pool are down due to outage the client accessing the webpage will get error 404 "webpage not found" instead of getting this page client wanted to redirect a direct webpage given by them. I finally figured a solution but have no idea whether it wil work awaiting for customer approval to implement and check.

     

     

    here is the irule i suggested

     

     

    when HTTP_RESPONSE {

     

    if { [HTTP::status] contains "404"} {

     

    HTTP::redirect "http://www.millsberry.com/999_DB_ERROR.phtml"

     

    }

     

    }

     

  • I am running 9.1.2 and I am trying to accomplish similiar redirect.

     

    I have tried fallback host , but works on any node down ( or not reachable

     

    eg. timeout). I also tried LB:; Failed, but had similiar results?

     

     

    My question to group is your opinion on following irule to redirect when all

     

    nodes in pool down to error page.

     

    TIA...Be gentle I am newbie at irules :-)

     

     

    rule minmembers {

     

    when HTTP_REQUEST {

     

    if { [active_members VistaHttp] < 1 } {

     

    HTTP::redirect http://so-mako.sysoff.ctstateu.edu/Vista-fa.nsf/VT-LBF?OpenForm

     

    }

     

    }

     

    }
  • It seems when I used fallback host that it triigered when any node was unreachable ( not down)eg. server wa sbusy etc. I only want the redirection when all nodes in pool are down.

     

    The clients are then redirected to error page on alternate server. Thanks for reply.
  • I am having the same issue, except I am redirecting many applications across many virtual servers.

     

     

    Would it be safe to apply the same logic by using the following code or is there a more effecient way to handle showing a page when the pool members are down?

     

     

    
    when RULE_INIT {
       set down_response "
    }
    when HTTP_REQUEST {
    switch [getfield [string tolower [HTTP::uri]] "/" 2] {
    app1 { 
    if { [active_members p1] < 1 } {
    HTTP::respond $down_response
    } else {
    pool p1 
    }
    app2 {
    if { [active_members p2] < 1 } {
    HTTP::respond $down_response
    } else {
    pool p2
    }
      ...
    appN { 
    if { [active_members pN] < 1 } {
    HTTP::respond $down_response
    } else {
    pool p1 
    }
    default { pool p_default }
    }
    }