kraken

Форк
0
/
proxy.go 
82 строки · 2.0 Кб
1
// Copyright (c) 2016-2019 Uber Technologies, Inc.
2
//
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
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
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.
14
package config
15

16
// ProxyTemplate is the default proxy nginx tmpl.
17
const ProxyTemplate = `
18
upstream registry {
19
  server {{.registry_server}};
20
}
21

22
upstream registry-override {
23
  server {{.registry_override_server}};
24
}
25

26
{{range .ports}}
27
server {
28
  listen {{.}};
29

30
  {{$.client_verification}}
31

32
  client_max_body_size 10G;
33

34
  access_log {{$.access_log_path}} json;
35
  error_log {{$.error_log_path}};
36

37
  gzip on;
38
  gzip_types text/plain test/csv application/json;
39

40
  # Committing large blobs might take a while.
41
  proxy_read_timeout 3m;
42

43
  location /v2/_catalog {
44
    proxy_pass http://registry-override;
45

46
    set $hostheader $hostname;
47
    if ( $host = "localhost" ) {
48
      set $hostheader "localhost";
49
    }
50
    if ( $host = "127.0.0.1" ) {
51
      set $hostheader "127.0.0.1";
52
    }
53
    if ( $host = "192.168.65.1" ) {
54
      set $hostheader "192.168.65.1";
55
    }
56
    if ( $host = "host.docker.internal" ) {
57
      set $hostheader "host.docker.internal";
58
    }
59
    proxy_set_header Host $hostheader:{{.}};
60
  }
61

62
  location / {
63
    proxy_pass http://registry;
64

65
    set $hostheader $hostname;
66
    if ( $host = "localhost" ) {
67
      set $hostheader "localhost";
68
    }
69
    if ( $host = "127.0.0.1" ) {
70
      set $hostheader "127.0.0.1";
71
    }
72
    if ( $host = "192.168.65.1" ) {
73
      set $hostheader "192.168.65.1";
74
    }
75
    if ( $host = "host.docker.internal" ) {
76
      set $hostheader "host.docker.internal";
77
    }
78
    proxy_set_header Host $hostheader:{{.}};
79
  }
80
}
81
{{end}}
82
`
83

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.