Forum Discussion
Redirecting to an external site when the internal site is down
Hi, folks,
I've read several articles with iRules for redirection and think I understand that part of my problem, but I've seen nothing about how to trigger the redirection when the local site is down, which is what I'm being asked to do.
Thanks,
John A
John_Adams It seems like we cannot use a variable that has been created in that section of code. You can try the following to see if this works for you.
when HTTP_REQUEST priority 500 { if { [active_members [LB::server pool]] == 0 } { HTTP::respond 307 content { <html> <head> <title>Apology Page</title> </head> <body> We are sorry, but the site you are looking for is temporarily out of service<br> If you feel you have reached this page in error, please try again. </body> </html> } } }
Hi,
It's more than doable by irule and i'm sure in a built policy.
But how about these references for a start
https://my.f5.com/manage/s/article/K6510
https://www.youtube.com/watch?v=r-GndW4H3ck
https://www.youtube.com/watch?v=nJLK8G7eqbUI've not looked at the youtube video's just search for them, but the f5 kb looks close to what you are looking for.
A policy may also be a quick fix to - i can find that method out to if you're not wanting to go down the irule route.- John_AdamsAltostratus
Hi,
I see that first video shows the use of HTTP::respond instead of HTTP::fallback! That's perfect, because the request is to return a 307, and it appears HTTP::fallback only returns a 302.
Thanks,
John A
John_Adams Typically this is achieved by using two pieces of configuration together.
1. The pool associated to the virtual server in question will have a health monitor for that site and if the response from the pool members is something other than what you define in the receive string then the pool member/s is/are considered down making the entire virtual server go down if the entire pool is down.
2. When the pool is completely down or the iRule defined criteria is met, such as less than 2 pool members of the over all pool members are available then you issue the redirect otherwise you just forward traffic to the pool and let load balancing occur.The following is an example iRule of how to perform this function with an example website. If you needed to narrow this down to a specific site and associate pool you could add in the additional matching criteria.
when CLIENT_ACCEPTED { set DEFAULT_POOL [LB::server pool] } when HTTP_REQUEST { if { [active_members [${DEFAULT_POOL}]] == 0 } { HTTP::respond 307 Temporary Redirect "http://www.example.com/" } }
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