I have a classic load balancer on beanstalk and configured nginx instances. I want to redirect http to https requests.
I setup my load balancer listeners to redirect to port 80 to its instances.
I created a file in .ebextensions/nginx_config.config, in which I setup the redirect and also filter out the healthcheck.
See the config rewrite below:
But nothing seems to happen and the server still doesn't redirect to https. It seems like my config is just being ignored. How can I redirect to https in this case?
So as per my suggestion above. Create an Application Load Balancer with 2 listeners.
1st Listener is a 443 HTTPS listener that serves traffic directly to your target group.
2nd Listener is a 80 HTTP listener that uses a redirect rule that does a redirect to HTTPS.
This is best practice.
You can have your load balancer listen on 443 with a certificate from ACM and then redirect that traffic to port 80? But it's highly suggested to used a ALB as said by @mokugo-devops above. Hope this helps. You can also look at a similar issue AWS EB - Redirect all traffic to https