Forum Discussion

hasnain_a's avatar
hasnain_a
Icon for Nimbostratus rankNimbostratus
Sep 25, 2018

Help with redirecting http to https irule

Hi,

Just like the subject states, we have created a new virtual server on the BIG IP on https that we would like a domain name example.com to be on. What I am looking to do is have http://example.com and http://www.example.com redirect to https://example.com or https://www.example.com. I tried using the built-in irule called _sys_https_redirect but that doesn't seem to work as I get an error saying too many redirects in Chrome. If I remove the irule then the site loads fine on https://example.com but http://example.com and wwww.example.com don't work. I also tried creating the below irule manually and applying it but that gives the same result as above (too many redirects error).


when HTTP_REQUEST {
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]"
}

One thing to note is that this Virtual server is not only using a clientssl profile thus doing the SSL offloading but it is also using a serverssl profile because the backend server is also running on https using a self signed cert.

Thank you.

2 Replies

  • you do not need to change your irule.

     

    But don't assign irule to virtual server listening port 443,

     

    just only assign redirect irule to the virtual server listening port 80

     

  • Create a new VS for port 80 HTTP. and assign http_to_https irule to it. Let above HTTPS virtual server be remain as it is.