Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active July 26, 2021 15:42
Show Gist options
  • Save miguelmota/5038c57b7986d90cf0303052dbb5fe5b to your computer and use it in GitHub Desktop.
Save miguelmota/5038c57b7986d90cf0303052dbb5fe5b to your computer and use it in GitHub Desktop.
Elastic Beanstalk NGINX rewrite http to https using .ebextensions
files:
"/etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf":
mode: "000755"
owner: root
group: root
content: |
server {
listen 80;
gzip on;
if ($http_x_forwarded_proto != 'https') {
rewrite ^(.*) https://$host$1 redirect;
}
location / {
proxy_pass http://docker;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment