diff --git a/docker/nginx/conf.d/include/location-skylink b/docker/nginx/conf.d/include/location-skylink index 6035321a..15883396 100644 --- a/docker/nginx/conf.d/include/location-skylink +++ b/docker/nginx/conf.d/include/location-skylink @@ -9,14 +9,6 @@ limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time # this is important because we want only one format in cache keys and logs set_by_lua_block $skylink { return require("skynet.skylink").parse(ngx.var.skylink) } -# $skylink_v1 and $skylink_v2 variables default to the same value but in case the requested skylink was: -# a) skylink v1 - it would not matter, no additional logic is executed -# b) skylink v2 - in a lua block below we will resolve the skylink v2 into skylink v1 and update -# $skylink_v1 variable so then the proxy request to skyd can be cached in nginx (proxy_cache_key -# in proxy-cache-downloads includes $skylink_v1 as a part of the cache key) -set $skylink_v1 $skylink; -set $skylink_v2 $skylink; - # variable for Skynet-Proof header that we need to inject # into a response if the request was for skylink v2 set $skynet_proof ''; @@ -53,5 +45,4 @@ proxy_set_header User-Agent: Sia-Agent; # in case the requested skylink was v2 and we already resolved it to skylink v1, we are going to pass resolved # skylink v1 to skyd to save that extra skylink v2 lookup in skyd but in turn, in case skyd returns a redirect # we need to rewrite the skylink v1 to skylink v2 in the location header with proxy_redirect -proxy_redirect $skylink_v1 $skylink_v2; -proxy_pass http://sia:9980/skynet/skylink/$skylink_v1$path$is_args$args; +proxy_pass http://sia:9980/skynet/skylink/$skylink$path$is_args$args; diff --git a/docker/nginx/conf.d/include/proxy-cache-downloads b/docker/nginx/conf.d/include/proxy-cache-downloads index e304fefb..99426f8c 100644 --- a/docker/nginx/conf.d/include/proxy-cache-downloads +++ b/docker/nginx/conf.d/include/proxy-cache-downloads @@ -1,12 +1,4 @@ add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses -# bypass - this will bypass cache hit on request (status BYPASS) -# but still stores file in cache if cache conditions are met -proxy_cache_bypass $cookie_nocache $arg_nocache "1"; - -# no cache - this will ignore cache on request (status MISS) -# and does not store file in cache under no condition -set $nocache "1"; - -# disable cache when nocache is set or skyd cache is enabled -proxy_no_cache $nocache; +# disable caching +proxy_no_cache "1"; diff --git a/docker/nginx/libs/skynet/account.lua b/docker/nginx/libs/skynet/account.lua index dc80d93d..99e97593 100644 --- a/docker/nginx/libs/skynet/account.lua +++ b/docker/nginx/libs/skynet/account.lua @@ -14,9 +14,6 @@ local anon_limits = { ["registry"] = 250 } --- basic caching of user data -local curr_limits - -- handle request exit when access to portal should be restricted to authenticated users only function _M.exit_access_unauthorized(message) ngx.status = ngx.HTTP_UNAUTHORIZED @@ -38,10 +35,6 @@ function _M.accounts_enabled() end function _M.get_account_limits() - if curr_limits ~= nil then - return curr_limits - end - local cjson = require('cjson') -- TODO: This needs to accommodate authorization tokens and api keys. @@ -66,8 +59,7 @@ function _M.get_account_limits() end end - curr_limits = cjson.decode(ngx.var.account_limits) - return curr_limits + return cjson.decode(ngx.var.account_limits) end -- detect whether current user is authenticated