Skip to content

Commit ef5991a

Browse files
committed
nginx: log tarball cache hit/miss info
1 parent 5df2c11 commit ef5991a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nginx.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ http {
3737
set_by_lua_block $npm_config_registry {
3838
return ngx.shared.npmConfig:get('npm_config_registry')
3939
}
40+
set $ephemeralCacheStatus '-';
4041
location ~ ^/(.+)/-/(.+\.tgz)$ {
4142
root /tmp/npm/store;
43+
set $ephemeralCacheStatus "HIT";
4244
try_files /$1/$2 @fetch-tgz;
4345
}
4446
location / {
45-
set $ephemeralCacheStatus '-';
4647
# We can't do caching at the proxy level because we can't easily
4748
# parameterize cache lifetime for proxy_cache. Instead, we do
4849
# the caching ourselves in Lua using a shared dict.
@@ -66,6 +67,7 @@ http {
6667
}
6768
location @fetch-tgz {
6869
internal;
70+
set $ephemeralCacheStatus "MISS";
6971
resolver 127.0.0.1 ipv6=off;
7072
proxy_pass $npm_config_registry;
7173
proxy_buffering on;

0 commit comments

Comments
 (0)