1
votes

I am using Elastic Beanstalk with a Node.js server, Load Balanced, and Nginx proxy. I want all addresses http://example.com to be rerouted to https://example.com.

I have tried the config below which lives in .ebextensions and looks like this:

files:
  "/etc/nginx/conf.d/000_https_redirect.conf":
    mode: "000755"
    owner: root
    group: root
    content: |
      server {
        listen 80;
        return 301 https://$host$request_uri;
      }

My Load Balancer has 80 pointing to 80 and 443 pointing to 80: enter image description here

1

1 Answers

0
votes

From your question it is not clear what exactly is going wrong, but maybe you could use the x-forwarded-proto in a rewrite condition.

I haven't tried this myself, but maybe something like: how to redirect http to https in nginx docker elastic beanstalk