The purpose of the iRule is to identify the destination port of an incoming HTTP request and respond to the client with:
HTTP/1.0 302 Found
Location: https://www.sitename.com
Connection/index.htm
Connection: close
Here is the rule:
rule https_only {
if (server_port equals 80) {
redirect to “https://%h/%u”
}
else {
discard
}