For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

dk_01's avatar
dk_01
Icon for Nimbostratus rankNimbostratus
Apr 01, 2016

Help with L7 Irule with maintenance redirect when pool is down

I am very new to Irules and I am trying to create a L7 header redirection Irule with a maintenance page redirection if the particular pool is down. This should be possible, but I am having issues getting it to work.

Right now I have 2 Irules applied to the VIP and I want to combine them with different redirects based on the Pool.

Irule 1 Layer7 redirection
    when HTTP_REQUEST {
    switch [string tolower [HTTP::host]] { 
    L7 Header Redirection
   "productA.com" { pool productA-pool  }  
   "productB.com" { pool productB-pool  } 
   "productC.com" {pool productC-pool} 
Irule 2 Maintenance redirection
    when HTTP_REQUEST {
set VSPool [LB::server pool]
 if { [active_members $VSPool] < 1 } {
        HTTP::redirect "http://www.maintenance.com"
      }
    }

This current setup works great if I want to send them to generic maintenance page. But now I'd like each pool to have their own maintenance redirect that more specific to the website. Example if productA-pool is down, redirect to productB-pool is down, redirect to etc.

I believe this can be done, but I can't seem to get my logic down in the Irule.

Any help with making this work would be appreciated.

thanks!

1 Reply

  • Josiah_39459's avatar
    Josiah_39459
    Historic F5 Account

    Instead of setting the pool you check to be the default pool (set VSPool [LB::server pool]), set it to the be the pool based on host using the same logic you have for the pool command (can probably set the variable in the same switch even.