Skip to content

Commit b419502

Browse files
committed
nginx: use proxy_store for tarballs
Since tarballs are never supposed to change and because we will eventually want a method of pre-seeding a registry, switch to a combination of try_files and proxy_store for the tarballs instead of using a real cache. Note that this _does_ have implications on disk usage of long-running instances since infrequently used tarballs will never be removed.
1 parent 3e94dc5 commit b419502

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

nginx.conf

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,8 @@ http {
4242
return upstream
4343
}
4444
location ~ ^/.*\.tgz$ {
45-
resolver 127.0.0.1 ipv6=off;
46-
proxy_pass $npm_config_registry;
47-
proxy_cache NPM;
48-
proxy_ignore_headers X-Accel-Redirect X-Accel-Expires X-Accel-Limit-Rate X-Accel-Buffering X-Accel-Charset Expires Cache-Control Set-Cookie Vary;
49-
# npm package tarballs are NEVER supposed to change
50-
proxy_cache_revalidate off;
51-
proxy_cache_valid 200 90d;
52-
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
45+
root /tmp/npm/store;
46+
try_files $uri @fetch-tgz;
5347
}
5448
location / {
5549
resolver 127.0.0.1 ipv6=off;
@@ -77,5 +71,14 @@ http {
7771
ngx.arg[1] = string.gsub(ngx.arg[1], upstream, base)
7872
}
7973
}
74+
location @fetch-tgz {
75+
internal;
76+
resolver 127.0.0.1 ipv6=off;
77+
proxy_pass $npm_config_registry;
78+
proxy_store on;
79+
proxy_store_access user:rw group:rw all:r;
80+
proxy_temp_path /tmp/npm/temp;
81+
root /tmp/npm/store;
82+
}
8083
}
8184
}

0 commit comments

Comments
 (0)