File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,18 @@ client_max_body_size 0;
55proxy_buffering off;
66proxy_request_buffering off;
77
8- proxy_set_header Host $host;
8+ # $http_host forwards the Host header verbatim, port included. $host drops a
9+ # non-default port, and core builds URLs back out of req.Host: the /v2/ token
10+ # challenge realm (src/server/middleware/v2auth/auth.go) and the cross-origin
11+ # check on /c/ both do. With $host, a deploy on PORT_HTTP=8080 hands docker a
12+ # realm of http://localhost/service/token and the push fails against port 80.
13+ # $http_host is empty for Host-less requests (HTTP/1.0, raw probes); fall
14+ # back to $host there so that traffic keeps the pre-existing behavior.
15+ set $forwarded_host $http_host;
16+ if ($http_host = '') {
17+ set $forwarded_host $host;
18+ }
19+ proxy_set_header Host $forwarded_host;
920proxy_set_header X-Real-IP $remote_addr;
1021proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1122proxy_set_header X-Forwarded-Proto $scheme;
You can’t perform that action at this time.
0 commit comments