I currently have an app built on a lightsail server.
I used Amazon certificate to create SSL https with a load balancer.
Under inbound traffic I have to protocols
Http Enabled
Https Enabled.
When I go to https://app.myexample.com sure enough I get an SSL certificate all good.
However I'd like to forward http to https. When you go to http://app.myexample.com you get no secure connection (obviously). How can I force http to go to https?
I was going to do it with an .htaccess file but I read somewhere that it should be done through the Load Balancer. Unfortunately all documentation for this is only for Elastic Beanstalk. I'm using Lightsail. How can I accomplish this on lightsail?
Best Answer
There is no way to do it on Lighsail services level, but!
AWS load balancer pass http_x_forwarded_proto header further.
It is possible to do redirect on your app, webserver level.
I'm using nginx web server, there this configuration looks like this