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

gweatherall_148's avatar
gweatherall_148
Icon for Nimbostratus rankNimbostratus
Jul 01, 2015

HTTPS to HTTP iRule Redirection

We recently shut down the nodes on a VIP that is no longer in use, but I would like traffic to be redirected to our new VIP if customers hit the old page. An HTTP redirect iRule works perfectly fine on the HTTP version of the old page, but I cannot get it to work with the HTTPS version. For example:

http://oldpage.website.com correctly redirects to http://website.com/newpage https://oldpage.website.com does not redirect to http://website.com/newpage

The iRule we use for redirection is as follows:

when HTTP_REQUEST {
        if { [HTTP::host] eq "oldpage.website.com" } {
          HTTP::redirect "http://website.com/newpage"
}
}

I created a Client SSL profile for the site and applied it to the HTTPS VIP, but traffic is still not redirecting. I've matched the Old HTTPS VIP configuration to be identical to the Old HTTP VIP configuration, with the only difference being the Client SSL profile.

Can anyone please explain what I'm missing?

4 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    What happens if you view the http request/response in fiddler, http fox? any clues here?

     

    I wonder if HTTP::respond might work better, try:

     

    HTTP::respond 301 Location "http://website.com/newpage"

     

    See if this helps.

     

    301 is better as it's a permanent move so search engines will cache this. A redirect it won't

     

    N

     

  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    Were you offloading the SSL to the F5 on the old HTTPS VIP? Can you add some logging to the iRule

    when CLIENT_ACCEPTED {
        if {[TCP::local_port] eq 443 } {set SSL 1} else {set SSL 0}
    }
    
    when HTTP_REQUEST { 
        if {$SSL} {log local0. "Request is SSL and Host is [HTTP::host]}
        if { [HTTP::host] eq "oldpage.website.com" } { HTTP::redirect "http://website.com/newpage" } 
    }
    
  • It turns out my iRule was written correctly. However, it probably would have helped if I had set it up on the active F5 instead of the standby!

     

    • kridsana's avatar
      kridsana
      Icon for Cirrocumulus rankCirrocumulus
      So after you config on active unit , it's working fine?