404 on v2 routes for the hostname v1.quay.io
This also copies v2 into its own separate location directive because you cannot have nested location directives. Also, the `if` directive can be very tricky and should only be used to return response codes.
This commit is contained in:
parent
1eb019cd16
commit
87a4e1f417
1 changed files with 24 additions and 1 deletions
|
@ -49,7 +49,30 @@ location ~ ^/(v1/repositories|v2/auth)/ {
|
||||||
limit_req zone=repositories burst=10;
|
limit_req zone=repositories burst=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(v1|v2)/ {
|
location ~ ^/v2 {
|
||||||
|
# If we're being accessed via v1.quay.io, pretend we don't support v2.
|
||||||
|
if ($host = "v1.quay.io") {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setting ANY header clears all inherited proxy_set_header directives
|
||||||
|
proxy_set_header X-Forwarded-For $proper_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
|
proxy_buffering off;
|
||||||
|
|
||||||
|
proxy_request_buffering off;
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
|
||||||
|
proxy_pass http://registry_app_server;
|
||||||
|
proxy_temp_path /tmp 1 2;
|
||||||
|
|
||||||
|
client_max_body_size 20G;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/v1 {
|
||||||
# Setting ANY header clears all inherited proxy_set_header directives
|
# Setting ANY header clears all inherited proxy_set_header directives
|
||||||
proxy_set_header X-Forwarded-For $proper_forwarded_for;
|
proxy_set_header X-Forwarded-For $proper_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
Reference in a new issue