Merge pull request #58 from jdoubleu/patch-1

Fixing web proxy dealing with protocols
This commit is contained in:
Yi EungJun 2016-11-23 01:30:50 +09:00 committed by GitHub
commit 77163a69c6
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,8 @@
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
server { server {
listen 80; listen 80;
@ -10,7 +15,7 @@ server {
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Frame-Options SAMEORIGIN; proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://app:APP_PORT; proxy_pass http://app:APP_PORT;
} }

View File

@ -4,6 +4,11 @@
# return 301 https://$server_name$request_uri; # return 301 https://$server_name$request_uri;
# } # }
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
server { server {
listen 443; listen 443;
@ -25,7 +30,7 @@ server {
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Frame-Options SAMEORIGIN; proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://app:APP_PORT; proxy_pass http://app:APP_PORT;
} }