Forum Discussion

Koalan's avatar
Koalan
Icon for Cirrus rankCirrus
Dec 02, 2019

Hide port in the URL

Hi my question is same with https://devcentral.f5.com/s/question/0D51T00006i7YgK/hide-port-in-url but i dont see the answer for this, so my setup is:

 

the client access VIP:443 like https://1.1.1.1/devcentral then F5 will redirect it with VIP:2001 or http://1.1.1.1:2001/devcentral

 

is there a way to hide :2001 ? Thank you!

  • Hi,

     

    No, there is no way to hide the port @client side as the port used is not the standard one (80 for HTTP). if you remove the port from the URL http://1.1.1.1:2001/devcentral, the client will automatically target the port 80.

  • below iRule will change return redirect URLs back to https and set remote port to https port:-

     

    when HTTP_RESPONSE {

    if { [HTTP::header is_redirect]} {

      HTTP::header replace Location https://[string map {"http://" ""} [string map ":[TCP::remote_port]/ :443/" [HTTP::header value Location]]]

      }

    }