Alternatively you can use a virtual server with port 0.
The wildcard of 0 lets the virtual listen on all ports.
Now you need to differentiate the handling depending on the service port.
This might be done via LTM policy or by iRule as the following one:
when CLIENT_ACCEPTED {
switch [LB::server port] {
80 {
SSL::disable
return
}
443 {
# some other iRule logic on tcp protocol level
}
default {
reject
}
}
}
when HTTP_REQUEST {
if { [LB::server port] == 80 } {
HTTP::respond 301 \
noserver \
Server "redirector" \
Location https://[getfield [HTTP::host] ":" 1][HTTP::uri] \
Date [clock format [clock seconds] -format {%a, %b %d %Y %H:%M:%S GMT} -gmt 1] \
Connection Close
} else {
# some other iRule logic on http protocol level
}
}