Forum Discussion

Javier_124486's avatar
Javier_124486
Icon for Nimbostratus rankNimbostratus
Nov 08, 2018

iRule to redirect http to https on the same port

Hello, i have an app published on port 8000, plain text. When i configure my vs for the same port with client SSL, encryption and the app works fine, although for some functions the app redirect the users to same port but http plain. I understand the concept of absolute URL and we are facing it, so, my question is, Do we have any way to create an irule that detects if the request is http redirect the user to https and apply it to the same VS.

 

Please consider that i only have one VS for the same port. I was thinking to conf a virtual server without client SSL and apply ssl client profile on the irule if the traffic is HTTPS.

 

I was thinking on something like the irule below, but i cannot find the correct condition, since http:: path or host or Method does not differentiate http or https.

 

when HTTP_REQUEST { if { [string tolower [HTTP::host]] starts_with "http" } {

 

HTTP::redirect "https://[HTTP::host][HTTP::uri]" }

 

}

 

2 Replies

    • Javier_124486's avatar
      Javier_124486
      Icon for Nimbostratus rankNimbostratus

      Because the default irules redirects all traffic to https so i need the specific condition in my irule to redirect only NON encrypted http. The system defined irule tends to be applied on the plain text VS (which unless forced to another Port the http traffic will go to 80 port). In my case i need to present HTTP and SSL HTTP on the same VS with a non standard port 8000, therefore i need to redirect specific traffic while engaging CLient SSL profile for the https only.

       

      The LTM policies does not contains any condition to detect differenciate plain http or encrypted http, since we usually identifies it based on port (or we applied the policy on the VS based on port.

       

      Sorry, but this will not work