Requirment: client accesss the website http://www.abc.co.uk we want to redirect them to https://www.abc.co.uk Solution: I find an easiest and effiecent way is to use HTTP class profile rather than an irule for this redirection. I am confuse on this point
You should write it exactly as it is in the reference document.
Note: The [getfield [HTTP::host] “:” 1] function above extracts the hostname from the host header and, if a non-standard port is specified, removes the port from the host header.
https://[getfield [HTTP::host] ":" 1][HTTP::uri]
By the way, there’s already a built-in HTTP-to-HTTPS redirect iRule on the BIG-IP called “sys_https_redirect”.
You should use http class (pre-v11.4) or a policy (v11.4+) to redirect http->https instead of an iRule unless you are doing something special on the http vip.
I have tested this HTTP class for a redirection and a built in irule. In both cases redirection sucessfully works but www. is missing or strip out when it redirect to https.