I have configured the load balancer to route the request to two of Ec2 Instance running a NodeJs server. I need to direct the request coming from both http (port 80) and https (port 443) to http (port 80) of the EC2 instances in NodeJs. I have uploaded the ssl certificate to AWS and configured the load balancer to use ssl certificate. The problem is the request coming from http port doesn't automatically route to https. It has to be a server side script or snipped which I need to write in server.js which should be routing the http to https, i tried to do it and it run into endless redirection. So questions -
- Is there any guide to do this from AWS ?
- If not then how one can achieve this, any pointers or suggestions would be greatly appreciated.


On the server side you can check the
X-Forwarded-Proto(original request protocol) and if it's heaving valuehttpyou can send redirect (http 302) to a url with https protocol..though with ALB (application load balancer you may specify a set of rules, maybe it's possible to do that there..)