Forum Discussion

chandu_naveen's avatar
chandu_naveen
Icon for Nimbostratus rankNimbostratus
Jul 16, 2019

need a irule for https url redirection.

Setup redirection to the default login page of this url. Whenever someone hits the below URL -

https://abc.com

 

needs to be redirected to 

https://abc.com/NextGene/login.html

  • Snl's avatar
    Snl
    Icon for Cirrostratus rankCirrostratus

    try below

    when HTTP_REQUEST {
     
    if { [HTTP::uri] equals "/"}
     
     {
     
      HTTP::redirect "https://[HTTP::host]/NextGene/login.html"
     
     }
     
    }
    • chandu_naveen's avatar
      chandu_naveen
      Icon for Nimbostratus rankNimbostratus

      Hi Snl,

      Thanks for response. i hope the above rule is for http to https redirect right. but i need https to https/login page redirection.

      Please look at my query once again.

  • Snl's avatar
    Snl
    Icon for Cirrostratus rankCirrostratus

    there is a built in default sys_https_redirect irule in F5 which you can apply to VS:80 and provided irule you can apply to VS:443 with http profile

    when HTTP_REQUEST {
    if { [HTTP::host] contains “abc.com” } {
    HTTP::redirect https://abc.com/NextGene/login.html
    }
    }
     
    OR 
     
    when HTTP_REQUEST {
    HTTP::redirect "https://abc.com/NextGene/login.html"
    }
  • Sajid's avatar
    Sajid
    Icon for Cirrostratus rankCirrostratus

    try this

     

     

     

    when HTTP_REQUEST {

     if { ( [string tolower [HTTP::host]] equals "abc.com") } {

      HTTP::redirect "https://abc.com/NextGene/login.html"

      }

    }

     

    or

     

     

    when HTTP_REQUEST { 

    switch -glob [HTTP::host] {

     "abc.com" {

      HTTP::redirect "https://abc.com/NextGene/login.html"

     }

     }

     default { }

     }

     

     

    Mapped iRule on HTTPS VS