Our BigIP is sitting in the dmz, so until now I was using one iRule to route the traffic based on the target IP coming from the firewall, and a second iRule to redirect the http requests to https:
iRule_1
=======
when HTTP_REQUEST { if { [IP::addr [IP::remote_addr] equals 1.1.1.1] }
{ HTTP::redirect "http://host.example.com" }
elseif { [IP::addr [IP::remote_addr] equals 1.1.1.2] }
{ HTTP::redirect "http://host.another.com" }
elseif { [IP::addr [IP::remote_addr] equals 1.1.1.3] }
{ HTTP::redirect "http://host.yetanother.com" }
}
____________________________________________
iRule_2
========
when HTTP_REQUEST {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
The LTM is BIG-IP 9.3.1 Build 37.1