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]" }
}