Forum Discussion
rajesh1
Nimbostratus
Apr 27, 2010IRULE - 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
1 Reply
- Cspillane_18296
Nimbostratus
Hello Raj,
this iRule is valid in terms of syntax. Have you been able to test it yet? If it doesn't appear to be working check the ltm logs for any errors.
I'd definately recommend downloading the iRule Editor, it makes writing and checking iRules alot easier.
Thanks.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects