Removing environment property to make the site work

0

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.

1개 답변
0

I think HTTPS can be used if the certificate is configured in the ALB as shown in the following document.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-elb.html

profile picture
전문가
답변함 10달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠