For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

RH's avatar
RH
Icon for Nimbostratus rankNimbostratus
Jan 05, 2018

Simple iRule HTTPS redirect in F5 LTM v12.1.2 (Build 1.0.271)

Trying to use a HTTPS redirect on a VS but I'm stuck.

We would like to redirect https://mysite.com towards https://www.mysite.com

What I have tried so far;

when HTTP_REQUEST { 
if { "https://[HTTP::host]" equals "mysite.com"} { 
  HTTP::redirect "https://www.mysite.com"} 
  }

But this does not seem to work. Tried google and searching on the forum, but still stuck.

Can anyone help me?

1 Reply

  • you don't need to specify the protocol for [HTTP::host], try this:

    when HTTP_REQUEST { 
        if {[HTTP::host] equals "mysite.com"} { 
            HTTP::redirect "https://www.mysite.com"
        } 
    }