1

I have a nodejs program that creates two servers.

HTTPS server running on port 3000

HTTP server running on port 8080 (it just forwards to my domain name with https)

I am trying to deploy this on elastic beanstalk.

I uploaded the certificate and opened HTTPS port in the elastic beanstalk (as outlined in this document: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https.html)

My application doesn't run at all. It goes red as soon as it is deployed. Looking at the logs, I see it trying to redirect to https domain name, but that goes nowhere.

I fail to see how Amazon would know which port has which. How would it know that port 3000 has https, and port 8080 has http? That is never mentioned anywhere. Perhaps that's the issue?

Any idea what to do? Many thanks.

user2771184
  • 709
  • 1
  • 5
  • 9

1 Answers1

0

Basically, you need to to coustumized your Elastic Beanstalk environment:

  • Elastic Load Balancer:
    • Listen on port 80 and proxy it to EC2 instance port 8080.
    • Listen on port 443 and proxy it to EC2 instance port 3000.
  • EC2 Web Server/Proxy (your Nginx/Apache):
    • Listen on port 8080 and response with redirect to HTTPS.
    • Listen on port 3000 and serve the request.

I thought your config failed because you configure ELB using Elastic Beanstalk Web Console. The Web Console only able to forward the HTTP and HTTPS into a single port in EC2 instance. So, your request is never handled by port 3000. You can't do this using Elastic Beanstalk Web Console, you need to apply this using another method, such as .ebextensions or CLI.

Please take a look into my answer here and my post in here.

Community
  • 1
  • 1
Edward Samuel
  • 3,846
  • 1
  • 22
  • 39