Forum Discussion

John_Adams's avatar
John_Adams
Icon for Altostratus rankAltostratus
Jun 06, 2023

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 ...
  • Paulius's avatar
    Paulius
    Jun 06, 2023

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