Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

F5 irule redirect with healthcheck

JamesCrk
Cirrus
Cirrus

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 3

Paulius
MVP
MVP

@JamesCrk I believe what you are looking for is a sideband but instead of doing that you might consider using a GTM or other GSLB to balance the DNS query for you instead of configuring a complicated iRule.

https://clouddocs.f5.com/api/irules/SIDEBAND.html

mwi
Altocumulus
Altocumulus

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
}
}

 

 

JamesCrk
Cirrus
Cirrus

thank you both, will give those a try!