rajesh1
Apr 28, 2010Nimbostratus
IRULE - HTTP REDIRECT
Hi,
I am new to Irules and i want someone to validate the my irule based on the following requirement.
we are having a website - www.example.com.au and www.example.co.nz sharing the same virtual ip address and the requirement is to redirect the HTTP request to the remote site if there are no active members in the local pool
www.example.com.au will be redirected to www2.example.co.au - if no active pool members
www.example.co.nz will be redirected to www2.example.co.nz - if no active pool members
Please check the syntax and logic and correct me if i am missing anything
when HTTP_REQUEST {
if { [active_members POOL-WEB] == 0 } {
if { [HTTP::host] contains "example.com.au" } {
HTTP::redirect https://www2.example.com.au[HTTP::uri] }
elseif { [HTTP::host] contains "example.co.nz" } {
HTTP::redirect https://www2.example.co.nz[HTTP::uri] }
}
else { pool POOL-WEB
}
}
Thanks
Raj