Last active
July 26, 2021 15:42
-
-
Save miguelmota/5038c57b7986d90cf0303052dbb5fe5b to your computer and use it in GitHub Desktop.
Elastic Beanstalk NGINX rewrite http to https using .ebextensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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