Irule Redirect URL full path Http to Https

Hello everyone

I currently have a service on a virtual server in which set up a self-signed certificate on the client side and the f5 to servers is http.

This is running smoothly, when I go to the URL https://myservice.com open the page well.

the problem I have it when I try to navigate within the options for example I open a link takes me to http://myservice.com/service1 and does not open the page.

to manually switch to https://myservice.com/service1 opens without problems.

I have other services:

https://myservice.com/service2 https://myservice.com/service3 https://myservice.com/service4 etc etc and I need redirect all services to https

do I would like your help to configure an Irule that if I’m going to a URL http:// I redirect to https while retaining the entire route, this is possible?

I tried this but did not work

when HTTP_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

Thanks

Hi Johann,

attach the iRule below to your HTTP-only Virtual Server. It will perform the HTTP-to-HTTPS redirect for you, while preserving the requested URI…

when HTTP_REQUEST {
    HTTP::respond 307 "Location" "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}

Note: Detach any previously configured HTTP-to-HTTPS redirect iRules on this Virtual Server.

Cheers, Kai