This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
2021-08-05 12:34:00 +00:00
|
|
|
include /etc/nginx/conf.d/include/cors;
|
|
|
|
include /etc/nginx/conf.d/include/sia-auth;
|
|
|
|
include /etc/nginx/conf.d/include/track-registry;
|
|
|
|
|
|
|
|
limit_req zone=registry_access_by_ip burst=600 nodelay;
|
|
|
|
limit_req zone=registry_access_by_ip_throttled burst=200 nodelay;
|
|
|
|
|
|
|
|
proxy_set_header User-Agent: Sia-Agent;
|
|
|
|
proxy_read_timeout 600; # siad should timeout with 404 after 5 minutes
|
|
|
|
proxy_pass http://siad/skynet/registry;
|
|
|
|
|
|
|
|
access_by_lua_block {
|
|
|
|
-- this block runs only when accounts are enabled
|
|
|
|
if os.getenv("ACCOUNTS_ENABLED") ~= "true" then return end
|
|
|
|
|
|
|
|
local res = ngx.location.capture("/accounts/user/limits", { copy_all_vars = true })
|
|
|
|
if res.status == ngx.HTTP_OK then
|
|
|
|
local json = require('cjson')
|
|
|
|
local limits = json.decode(res.body)
|
|
|
|
if limits.registry > 0 then
|
|
|
|
ngx.sleep(limits.registry / 1000)
|
|
|
|
end
|
|
|
|
end
|
2021-08-05 12:46:04 +00:00
|
|
|
}
|