Forum Discussion

Tyson_James's avatar
Jun 05, 2020

Redirect to another URL after timeout detected

Is there a way for a BIG-IP to display a message such as “This site has moved, please note the new URL." and then redirect to the new page in 10 seconds.

  • Not tested so far. Can you write iRule something like this. Try and let us know if any question

    when HTTP_REQUEST {
            set expires "10000"
            HTTP::respond 200 content "Sorry, this page is not currently available."; Max-Age=$expires"
    		HTTP::redirect "https://www.xyz.com"
        }
    • SubratDash's avatar
      SubratDash
      Icon for Nimbostratus rankNimbostratus

      Hi Samir,

       

      I tried with this IRule but it

      not working for me, I can see the message but after that redirection is not

      working.

       

      One of our URL is getting retired and getting replaced with new one. So when any user trying to access old url, it should display a message for 5 seconds to users that its retired and redirect to new URL.

       

      Can you please help on this.

  • Yes its doable, I've done some recently too. But I used the Ifile method, but the concept is same,

    Create an Ifile with below content,

    <html>
    <head>
    <meta http-equiv="Refresh" content="10; url=https://www.newwebsite.com" />
    </head>
    <body><p><center>This URL is being retired. You are being redirected to new site -<a href="https://www.newwebsite.com">New Website name</a>.</center></p>
    </body>
    </html>

    Then load that ifile in Irule,

    when HTTP_REQUEST {
            if { [HTTP::uri] equals "/index.html"}{
            HTTP::respond 200 content [ifile get "new-website.html"] "Content-Type" "text/html"
            }
        }
    }