F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

JamesCrk's avatar
JamesCrk
Icon for Cirrus rankCirrus
Nov 14, 2023

F5 irule redirect with healthcheck

Hi guys,

 

how can we do something like so:

 

 

when HTTP_REQUEST {
if { [HTTP::host] eq "mainsite.com" } {

(check here is http://site1.com up and responding - if yes)  
HTTP::redirect http://site1.com

 } Else {
HTTP::redirect http://site2.com
}
}

 

 

 

 

3 Replies

  • i havent testet it, but i think it should work if you put site1.com in a pool with a http monitor and check active_members.

    Something like that

    when HTTP_REQUEST {
    if { [HTTP::host] eq "mainsite.com" } {
    
    if { [active_members pool_site1] > 0 } {
    HTTP::redirect http://site1.com
    
     } Else {
    HTTP::redirect http://site2.com
    }
    }