Forum Discussion
Redirect iRule is not working
Morning F5 World,
What I have I have a monitor set up which is searching for a robots.txt file.
Send String: GET /robots.txt HTTP/1.0\r\n\r\n Receive String: 200 OK
When the web server is offline, the probe goes offline, I've also tested with a different number for the receive string so I believe the probe is doing as it should.
What I want from my iRule So when the probe for the text file goes offline, it should redirect traffic to another website.
How my iRule is setup when HTTP_REQUEST {
if {[active_members POOLNAME]>0} { pool POOLNAME } else { HTTP::redirect "http://IPADDRESS:80" } }
What happened while we were testing 1. We turned off the of the web services 2. Probe for the text file was inactive 3. The redirect didn't work 4. If I SSH to the F5, I can see the redirect page via the curl command 5. I can ping the IP via SSH, so this leads me to believe there is an issue with my iRule.
Could someone please point me in the right direction with regards to how to get this iRule sorted please?
Kind Regards,
Chet
7 Replies
- Pls. provide VS/pool config parts. Not clear how your setup looks like.
Try this:
when LB_FAILED { HTTP::redirect "http://IPADDRESS" }What this will do is when there are no members to load balance to, it triggers the LB_FAILED event, and you can redirect users do another page. We use this event to throw a page informing users the site is down
- shaggy
Nimbostratus
the irule looks fine. do you see the redirect if you curl from a remote machine when all pool members are down? are you able to ping the virtual-address when all pool members are down?
- chetan_2_chauha
Nimbostratus
I can curl to the sorry server when the pool members are down. I can ping the sorry server from our F5s as well.
- shaggy_121467
Cumulonimbus
the irule looks fine. do you see the redirect if you curl from a remote machine when all pool members are down? are you able to ping the virtual-address when all pool members are down?
- chetan_2_chauha
Nimbostratus
I can curl to the sorry server when the pool members are down. I can ping the sorry server from our F5s as well.
- chetan_2_chauha
Nimbostratus
After searching through the forums, I have changed my iRule slightly.
when HTTP_REQUEST {
if {[active_members POOLNAME] == 0} { HTTP::redirect " } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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