change request from HTTP to HTTPS

Hallo,

i need to change the protocol of HTTP-Requests to HTTPS, for example:

http://www.example.org:80/demo1/example1…

to

https://www.example.org:443/demo1/example1

or:

http://www.example.org:8080/demo2/example2…

to

https://www.example.org:8443/demo2/example2

URL may be different, only host is the same every time.

We use LTM 1600 with 9.4.5

Can someone help me please?

Hajo

Try this:

when HTTP_REQUEST { 
 if {[TCP::local_port] == 8080} { 
 HTTP::redirect https://[getfield [HTTP::host] ":" 1]:8443[HTTP::uri] 
 } else { 
 HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] 
 } 
 }