From 566768558cfb3cc79497b246660029fa41a17024 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Mon, 13 Apr 2015 14:03:10 -0700 Subject: [PATCH] Update nginx proxy setting to set forward headers Set forward headers so the IP and scheme get sent to the registry. This allows the registry to set a proper redirect with the correct scheme when HTTPS is being used. Signed-off-by: Derek McGowan (github: dmcgowan) --- contrib/compose/nginx/docker-registry-v2.conf | 10 ++++++---- contrib/compose/nginx/docker-registry.conf | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/compose/nginx/docker-registry-v2.conf b/contrib/compose/nginx/docker-registry-v2.conf index c48886db..65c4d776 100644 --- a/contrib/compose/nginx/docker-registry-v2.conf +++ b/contrib/compose/nginx/docker-registry-v2.conf @@ -1,4 +1,6 @@ -proxy_pass http://docker-registry-v2; -proxy_set_header Host $http_host; # required for docker client's sake -proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP -proxy_read_timeout 900; +proxy_pass http://docker-registry-v2; +proxy_set_header Host $http_host; # required for docker client's sake +proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header X-Forwarded-Proto $scheme; +proxy_read_timeout 900; diff --git a/contrib/compose/nginx/docker-registry.conf b/contrib/compose/nginx/docker-registry.conf index bdcf3a34..5b1a2d58 100644 --- a/contrib/compose/nginx/docker-registry.conf +++ b/contrib/compose/nginx/docker-registry.conf @@ -1,5 +1,7 @@ -proxy_pass http://docker-registry; -proxy_set_header Host $http_host; # required for docker client's sake -proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP -proxy_set_header Authorization ""; # see https://github.com/docker/docker-registry/issues/170 -proxy_read_timeout 900; +proxy_pass http://docker-registry; +proxy_set_header Host $http_host; # required for docker client's sake +proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header X-Forwarded-Proto $scheme; +proxy_set_header Authorization ""; # see https://github.com/docker/docker-registry/issues/170 +proxy_read_timeout 900;