disable nginx cache download

This commit is contained in:
Ivaylo Novakov 2022-03-14 14:17:49 +01:00
parent 9b95c671ac
commit 0678e298e2
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
1 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
include /etc/nginx/conf.d/include/cors; 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/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) # 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 # 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-Portal-Api"] = ngx.var.scheme .. "://" .. ngx.var.skynet_portal_domain
ngx.header["Skynet-Server-Api"] = ngx.var.scheme .. "://" .. ngx.var.skynet_server_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 #-- the block below only makes sense if we are using nginx cache
if not ngx.var.skyd_disk_cache_enabled then #if not ngx.var.skyd_disk_cache_enabled then
-- not empty skynet_proof means this is a skylink v2 request # -- not empty skynet_proof means this is a skylink v2 request
-- so we should replace the Skynet-Proof header with the one # -- so we should replace the Skynet-Proof header with the one
-- we got from /skynet/resolve/ endpoint, otherwise we would # -- we got from /skynet/resolve/ endpoint, otherwise we would
-- be serving cached empty v1 skylink Skynet-Proof header # -- be serving cached empty v1 skylink Skynet-Proof header
if ngx.var.skynet_proof and ngx.var.skynet_proof ~= "" then # if ngx.var.skynet_proof and ngx.var.skynet_proof ~= "" then
ngx.header["Skynet-Proof"] = ngx.var.skynet_proof # ngx.header["Skynet-Proof"] = ngx.var.skynet_proof
end # end
-- add skylink to nocache list if it exceeds 1GB (1e+9 bytes) threshold # -- 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) # -- (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 # 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"]) # ngx.shared.nocache:set(ngx.var.skylink_v1, ngx.header["Content-Length"])
end # end
end #end
} }
proxy_read_timeout 600; proxy_read_timeout 600;