clean up nginx cache specific code
This commit is contained in:
parent
485a8e9b45
commit
9241979ca5
|
@ -25,6 +25,8 @@ set $skynet_proof '';
|
|||
set $limit_rate 0;
|
||||
|
||||
access_by_lua_block {
|
||||
-- the block below only makes sense if we are using nginx cache
|
||||
if not ngx.var.skyd_disk_cache_enabled then
|
||||
local httpc = require("resty.http").new()
|
||||
|
||||
-- detect whether requested skylink is v2
|
||||
|
@ -61,6 +63,7 @@ access_by_lua_block {
|
|||
if ngx.shared.nocache:get(ngx.var.skylink_v1) then
|
||||
ngx.var.nocache = "1"
|
||||
end
|
||||
end
|
||||
|
||||
if require("skynet.account").accounts_enabled() then
|
||||
-- check if portal is in authenticated only mode
|
||||
|
@ -85,6 +88,8 @@ header_filter_by_lua_block {
|
|||
ngx.header["Skynet-Portal-Api"] = ngx.var.scheme .. "://" .. os.getenv("PORTAL_DOMAIN")
|
||||
ngx.header["Skynet-Server-Api"] = ngx.var.scheme .. "://" .. os.getenv("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
|
||||
|
@ -98,6 +103,7 @@ header_filter_by_lua_block {
|
|||
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
|
||||
}
|
||||
|
||||
limit_rate_after 512k;
|
||||
|
|
Reference in New Issue