1818 # this is necessary for us to be able to disable request buffering in all cases
1919 proxy_http_version 1.1;
2020
21- #SSLCONFIG
22-
2321 # will run before forking out nginx worker processes
2422 init_by_lua_block { require "cjson" }
2523
2927 }
3028
3129 server {
32- listen LISTEN default_server;
30+ listen PORT SSL_LISTEN default_server;
3331
34- #AUTHCONFIG
32+ SSL_INCLUDE
3533
3634 # Cache
3735 add_header X-Cache-Status $upstream_cache_status ;
@@ -52,28 +50,21 @@ http {
5250
5351 # disable proxy request buffering
5452 proxy_request_buffering off;
55- proxy_cache cache;
56- proxy_cache_key $scheme$uri$args$request_method ;
57- proxy_cache_valid 200 1s ;
58- proxy_cache_use_stale error timeout invalid_header updating
59- http_500 http_502 http_503 http_504;
60- proxy_cache_lock on;
6153
6254 add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
6355 add_header "Access-Control-Allow-Origin" "*" ;
6456
6557 location / {
6658 set $url UPSTREAM;
6759 proxy_pass $url ;
68- proxy_redirect $url http ://$host :PORT;
60+ proxy_redirect $url SCHEME ://$host :PORT;
6961
7062 # Add AWS ECR authentication headers
7163 proxy_set_header X-Real-IP $remote_addr ;
7264 proxy_set_header X-Forwarded-For $remote_addr ;
7365 proxy_set_header X-Forwarded-User "Basic $http_authorization" ;
7466 proxy_set_header Authorization "Basic $http_authorization" ;
7567 proxy_set_header X-Forwarded-Proto $scheme ;
76- proxy_set_header Authorization "" ;
7768
7869 }
7970
@@ -82,15 +73,14 @@ http {
8273 location ~ ^/v2/.*/blobs/[a-z0-9]+:[a-f0-9]+$ {
8374 set $url UPSTREAM;
8475 proxy_pass $url ;
85- proxy_redirect $url http ://$host :PORT;
76+ proxy_redirect $url SCHEME ://$host :PORT;
8677
8778 # Add AWS ECR authentication headers
8879 proxy_set_header X-Real-IP $remote_addr ;
8980 proxy_set_header X-Forwarded-For $remote_addr ;
9081 proxy_set_header X-Forwarded-User "Basic $http_authorization" ;
9182 proxy_set_header Authorization "Basic $http_authorization" ;
9283 proxy_set_header X-Forwarded-Proto $scheme ;
93- proxy_set_header Authorization "" ;
9484
9585 # When accessing image blobs using HTTP GET AWS ECR redirects with
9686 # s3 buckets uri to download the image. This needs to handled by
@@ -106,7 +96,7 @@ http {
10696 set $saved_redirect_location '$upstream_http_location' ;
10797 proxy_pass $saved_redirect_location ;
10898 proxy_cache cache;
109- proxy_cache_key $scheme$uri$args$request_method ;
99+ proxy_cache_key CACHE_KEY ;
110100 proxy_cache_valid 200 1y ;
111101 proxy_cache_use_stale error timeout invalid_header updating
112102 http_500 http_502 http_503 http_504;
@@ -115,7 +105,6 @@ http {
115105
116106 location ~ ^/v2/.*/.*/tags/list+$ {
117107 # get paginated list of tags
118- proxy_set_header Authorization "" ;
119108 content_by_lua_block {
120109 local location , tags, cjson = ngx.var.uri, {} , require "cjson"
121110 while true do
@@ -147,7 +136,6 @@ http {
147136 internal ;
148137 set_unescape_uri $req_uri $arg_req_uri ;
149138 proxy_pass UPSTREAM$req_uri ;
150- proxy_set_header Authorization "" ;
151139
152140 # Add AWS ECR authentication headers
153141 proxy_set_header X-Real-IP $remote_addr ;
0 commit comments