Forum Discussion

Anush's avatar
Anush
Icon for Nimbostratus rankNimbostratus
Dec 18, 2018

redirect http to https and remove port number in redirected URL

Hi Experts, Please help me on this.

 

redirect requirements are following:

 

http://appadmin.com:9081/desktop/desktop.htm redirect to https://appadmin.com/desktop/desktop.htm http://appadmin.com:9081/tpadmintool/default.htm rediect to https://appadmin.com/tpadmintool/default.htm http://appadmin.com:1082/english/ redirect to https://appadmin.com/english/

 

so basically removing port number and redirecting http to https.

 

in current config I have four VIPs with same IP but different port numbers like HTTP, HTTPS, 9081 and 1082. Non-HTTPs VIPS have sys_https_redirect rule on it and HTTPS VIP has irule which redirect to corresponding URL by removing port number.

 

Is there a short and efficient config I can use for same requirements?

 

2 Replies

  • Try this irule:

     

    when HTTP_REQUEST { http::respond 302 https://[HTTP::host/[HTTP::uri] }

     

    Hope this helps!

     

  • This is the default _sys_https_redirect irule behavior!!!!

     

    No need to write your irule, f5 already created it and include it in f5 product.