Forum Discussion

3 Replies

  • You can try this

    when HTTP_REQUEST {
        if {([HTTP::host] equals "irule.sample.com") && ([HTTP::uri] equals "/")} {
        HTTP::redirect "https://irule.newsample.com/launcher/irule"
        }
    }
    
  • when HTTP_REQUEST {
      if { ([HTTP::host] == "irule.sample.com") && ([HTTP::path] == "/" )}{
        HTTP::respond 302 location "https://irule.newsample.com/launcher/irule"  Invokes a temporary 302 redirect, replace with 301 if you want permanent instead.
        event disable  Recommended function, if you use other iRules that also utilize the HTTP_REQUEST event.
        TCP::close  Recommended because it resolves the issue with redirect not functioning from the second web-browser tab if already invoked more than once. (issue applies to Chrome and HTTP/1.1).
      }
    }
    

    Test it out. I've added some comments to help you understand the lines. You will need to apply the iRule to your TCP/443 port listener Virtual Server. Also for the iRule to work, your VS must have a clientside SSL profile configured as well as a HTTP profile.