Forum Discussion

Jereme_De_Leo_4's avatar
Jereme_De_Leo_4
Icon for Nimbostratus rankNimbostratus
Oct 04, 2006

Fallback iRule

Greetings;

 

 

I am wanting to use the fallback host feature of the Big-IP to redirect users to a static "sorry" page when all nodes are unavailable in a pool. According to SOL6510 (https://tech.f5.com/home/solutions/sol6510.html), the fallback host will also be used to redirect an existing connection when a single server dies mid-session. This is not a good option for our environment.

 

 

The F5 solution listed above (SOL6510) provides an iRule (listed below) to have the Big-IP do nothing if a node dies while there are still other nodes available, thus making connections only redirect to the fallback host when there are no nodes available.

 

 

Is there a way to tweak this iRule so that, instead of doing nothing, the Big-IP will redirect a user to a different static URL if a single node dies mid-session? This way, the user will get a pretty page saying "sorry, your connection died, please retry" instead of a hung browser (404). And when they refresh, they will be load balanced to an available node. But, should all nodes be unavailable, the fallback host will be used.

 

 

----Start iRule Provided in SOL6510----

 

 

when LB_FAILED {

 

The following action (no action) will be triggered if the

 

connection fails while the pool still has available members.

 

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

 

} else {

 

The following action will be triggered if the connection fails

 

while the pool has no available members.

 

HTTP::fallback ""

 

}

 

}

 

 

----End iRule Provided in SOL6510----

 

 

Thank you in advance for your help.

 

 

Yours,

 

 

jddevcen

4 Replies

  • Another thought about the above post...

     

     

    Our sorry page is worded in such a way to indicate that the site is down. This makes it not preferable for us to use the Fallback Host, since SOL6510 indicates that the Fallback Host will even be used for a client whose server connection dies, even if there are other nodes available in the pool. So, in our case, a client whose server dies mid-session would be redirected to a page that tells them our site is down, even though there are other nodes available to handle the user’s traffic. Not good.

     

     

    Now, SOL6510 gives a workaround: Use the iRule listed in the Solution. Here is my question: Is the iRule to be used INSTEAD of the Fallback Host, or WITH the Fallback Host? The iRule references HTTP:Fallback “”, but I am unclear on whether I am supposed to leave the “” as is and put the sorry page URL in the Fallback field of the HTTP Profile, or if am I supposed to add my sorry page URL in the iRule and not use the Fallback field of the HTTP Profile.

     

     

    Your help in clarifying this is greatly appreciated.

     

     

    Thank you,

     

     

    jddevcen
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The iRule can be used either with or in place of a fallback host. This is why there is a fallback command in the iRule, as you can see in your above post.

     

     

    Inside the quotes after the HTTP::fallback command you specify the destination you want for the fallback host, as is explained in the Wiki here: Click here

     

     

    Colin
  • Colin,

     

     

    Thanks for the reply. It does clear things up for me.

     

     

    Regarding my first post in this thread, would the following be a valid iRule to send a client to one URL if a server dies in the middle of an active connection, and send clients to another URL if there are no active pool members to load balance to?

     

     

    ----

     

    when LB_FAILED {

     

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

     

    HTTP::fallback "http://www.fallback.com/sorry1.htm"

     

    } else {

     

    HTTP::fallback "http://www.fallback.com/sorry2.htm"

     

    }

     

    }

     

    ----

     

     

    Thanks,

     

     

    jddevcen