Hello,
I have a question. I am running a node js / express web app on https through elastic beanstalk, code pipeline, and github. Under Instance traffic and scaling I've configured two Listeners in the console for 443 with listener protocol HTTPS, and 80 with listener protocol HTTP. In my application load balancer (found from my ec2 dashboard) under the Listeners and rules I've configured protocol:port HTTP:80 to redirect to HTTPS://... :443/.. etc. Also in my repository I uploaded the http to https redirect config file (specifically the one where you already define a 443 listener) found here.
I have two lines in my app.js
file with const port = process.env.PORT
and app.listen(port, ...)
etc for the usual get-the-app-running-on-the-port.
What I noticed, though, was that when I define an environment property of PORT
with value 443
under Configuration in the beanstalk environment, the site doesn't work. It throws a 502 Bad Gateway | nginx error. When I remove the environment property, the site works. It redirects and all.
Does the PORT
443
in the envir. properties not actually define the listener for https in elastic beanstalk? Is it rather the 443
under Listeners > Instance traffic and scaling ? If so, why? It seems that one is removing environment properties in order to make the site work.