From 0678e298e2c1a947a31ea3f2d21dfb0c364d5227 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Mon, 14 Mar 2022 14:17:49 +0100 Subject: [PATCH] disable nginx cache download --- docker/nginx/conf.d/include/location-skylink | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docker/nginx/conf.d/include/location-skylink b/docker/nginx/conf.d/include/location-skylink index abca26f6..4ccb99ed 100644 --- a/docker/nginx/conf.d/include/location-skylink +++ b/docker/nginx/conf.d/include/location-skylink @@ -1,7 +1,7 @@ include /etc/nginx/conf.d/include/cors; -include /etc/nginx/conf.d/include/proxy-buffer; +include /etc/nginx/conf.d/include/proxy-buffer; # tried removing this one #include /etc/nginx/conf.d/include/proxy-cache-downloads; -include /etc/nginx/conf.d/include/track-download; +include /etc/nginx/conf.d/include/track-download; # tried removing this one # ensure that skylink that we pass around is base64 encoded (transform base32 encoded ones) # this is important because we want only one format in cache keys and logs @@ -72,22 +72,22 @@ header_filter_by_lua_block { ngx.header["Skynet-Portal-Api"] = ngx.var.scheme .. "://" .. ngx.var.skynet_portal_domain ngx.header["Skynet-Server-Api"] = ngx.var.scheme .. "://" .. ngx.var.skynet_server_domain - -- the block below only makes sense if we are using nginx cache - if not ngx.var.skyd_disk_cache_enabled then - -- not empty skynet_proof means this is a skylink v2 request - -- so we should replace the Skynet-Proof header with the one - -- we got from /skynet/resolve/ endpoint, otherwise we would - -- be serving cached empty v1 skylink Skynet-Proof header - if ngx.var.skynet_proof and ngx.var.skynet_proof ~= "" then - ngx.header["Skynet-Proof"] = ngx.var.skynet_proof - end + #-- the block below only makes sense if we are using nginx cache + #if not ngx.var.skyd_disk_cache_enabled then + # -- not empty skynet_proof means this is a skylink v2 request + # -- so we should replace the Skynet-Proof header with the one + # -- we got from /skynet/resolve/ endpoint, otherwise we would + # -- be serving cached empty v1 skylink Skynet-Proof header + # if ngx.var.skynet_proof and ngx.var.skynet_proof ~= "" then + # ngx.header["Skynet-Proof"] = ngx.var.skynet_proof + # end - -- add skylink to nocache list if it exceeds 1GB (1e+9 bytes) threshold - -- (content length can be nil for already cached files - we can ignore them) - if ngx.header["Content-Length"] and tonumber(ngx.header["Content-Length"]) > 1e+9 then - ngx.shared.nocache:set(ngx.var.skylink_v1, ngx.header["Content-Length"]) - end - end + # -- add skylink to nocache list if it exceeds 1GB (1e+9 bytes) threshold + # -- (content length can be nil for already cached files - we can ignore them) + # if ngx.header["Content-Length"] and tonumber(ngx.header["Content-Length"]) > 1e+9 then + # ngx.shared.nocache:set(ngx.var.skylink_v1, ngx.header["Content-Length"]) + # end + #end } proxy_read_timeout 600;