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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ