1
// Copyright (c) 2016-2019 Uber Technologies, Inc.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
16
// ProxyTemplate is the default proxy nginx tmpl.
17
const ProxyTemplate = `
19
server {{.registry_server}};
22
upstream registry-override {
23
server {{.registry_override_server}};
30
{{$.client_verification}}
32
client_max_body_size 10G;
34
access_log {{$.access_log_path}} json;
35
error_log {{$.error_log_path}};
38
gzip_types text/plain test/csv application/json;
40
# Committing large blobs might take a while.
41
proxy_read_timeout 3m;
43
location /v2/_catalog {
44
proxy_pass http://registry-override;
46
set $hostheader $hostname;
47
if ( $host = "localhost" ) {
48
set $hostheader "localhost";
50
if ( $host = "127.0.0.1" ) {
51
set $hostheader "127.0.0.1";
53
if ( $host = "192.168.65.1" ) {
54
set $hostheader "192.168.65.1";
56
if ( $host = "host.docker.internal" ) {
57
set $hostheader "host.docker.internal";
59
proxy_set_header Host $hostheader:{{.}};
63
proxy_pass http://registry;
65
set $hostheader $hostname;
66
if ( $host = "localhost" ) {
67
set $hostheader "localhost";
69
if ( $host = "127.0.0.1" ) {
70
set $hostheader "127.0.0.1";
72
if ( $host = "192.168.65.1" ) {
73
set $hostheader "192.168.65.1";
75
if ( $host = "host.docker.internal" ) {
76
set $hostheader "host.docker.internal";
78
proxy_set_header Host $hostheader:{{.}};