Forum Discussion

Kahle_260273's avatar
Kahle_260273
Icon for Nimbostratus rankNimbostratus
Dec 05, 2016

Irule to redirect all incoming traffic

Hi, I am trying to make an Irule that will redirect all traffic to a new URL. Little back story. We have our website hosted on one server and our out of service page hosted on another. The f5 fails over properly, and once load balanced to the out of service pool member displays the proper page, but only if they go to , if they try to go to it displays a generic 404 page instead of redirecting them to main out of service page. I would like to apply an Irule that will redirect all traffic coming in despite the "/whatever" to the actual out of service page. The other catch is I need it to only be applied if the primary pool member is down and we have failed over to the out of service member. Any Ideas on how I could accomplish this?

 

Thanks in advance Kahle

 

1 Reply

  • Maybe you don't need an iRule. In the HTTP profile it is possible to enter a 'Fallback Host'. The help funtions notes:

    "Type the fallback host to send as an HTTP 302 response, when all nodes are down."

    You could also use the iRule from this SOL:

    https://support.f5.com/kb/en-us/solutions/public/6000/500/sol6510.html

    when LB_FAILED {
        if { [active_members [LB::server pool]] < 1 } {
             The redirect will be sent only if LB_FAILED
             was because the pool had no available members.
            HTTP::fallback "http://host.domain.com/redirect.html"
        }
    }