From 4f582ad996ab7c97063732e24930133a66b70645 Mon Sep 17 00:00:00 2001 From: Shiela M Parker Date: Tue, 23 May 2017 10:21:56 -0700 Subject: [PATCH] Add instructions to remove also proxy_set_header Host (#3156) (#3342) * Add instructions to remove also proxy_set_header Host Add instructions to remove also proxy_set_header Host when using ELB. In my case I only had commented out X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, but not Host, and I was getting lots of retrys in Docker. Commenting the proxy_set_header Host fixed the issue, as recommended in https://github.com/moby/moby/issues/16949 --- docs/recipes/nginx.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/recipes/nginx.md b/docs/recipes/nginx.md index 9c88256a9..7708ed388 100644 --- a/docs/recipes/nginx.md +++ b/docs/recipes/nginx.md @@ -51,16 +51,17 @@ X-Forwarded-For X-Forwarded-Proto ``` -So if you have an nginx sitting behind it, should remove these lines from the +So if you have an Nginx instance sitting behind it, remove these lines from the example config below: -``` -X-Real-IP $remote_addr; # pass on real client's IP -X-Forwarded-For $proxy_add_x_forwarded_for; -X-Forwarded-Proto $scheme; +```none +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; ``` -Otherwise nginx will reset the ELB's values, and the requests will not be routed +Otherwise Nginx will reset the ELB's values, and the requests will not be routed properly. For more information, see [#970](https://github.com/docker/distribution/issues/970). @@ -198,4 +199,4 @@ tag and push your first image: docker login -u=testuser -p=testpassword -e=root@example.ch myregistrydomain.com:5043 docker tag ubuntu myregistrydomain.com:5043/test docker push myregistrydomain.com:5043/test - docker pull myregistrydomain.com:5043/test \ No newline at end of file + docker pull myregistrydomain.com:5043/test