We create a separate port listener in web server config, forwart all HTTP connections from load balancer to this port, and configure web server to redirect all connections on this port to https
#add port 1443 listener to EC2 security group
Custom TCP Rule TCP 1443 <load balancer group id>
#add load balancer rules:
HTTP 80 HTTP 1443 N/A N/A
HTTPS 443 HTTP 80 <Cipher> <SSL Certificate>
#add web server config apache:
Listen 1443
<VirtualHost *:1443>
RewriteEngine On
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}
</VirtualHost>
nginx:
server {
listen 1443;
return 301 https://$server_name$request_uri;
}