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-27 12:15:22 +00:00
|
|
|
include /etc/nginx/conf.d/include/cors;
|
|
|
|
include /etc/nginx/conf.d/include/proxy-buffer;
|
|
|
|
include /etc/nginx/conf.d/include/proxy-cache-downloads;
|
|
|
|
include /etc/nginx/conf.d/include/track-download;
|
|
|
|
|
|
|
|
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
|
|
|
|
|
2021-11-05 11:57:06 +00:00
|
|
|
# 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
|
2022-03-10 08:55:24 +00:00
|
|
|
set_by_lua_block $skylink { return require("skynet.skylink").parse(ngx.var.skylink) }
|
2021-11-05 11:57:06 +00:00
|
|
|
|
2021-08-27 12:15:22 +00:00
|
|
|
# default download rate to unlimited
|
|
|
|
set $limit_rate 0;
|
|
|
|
|
|
|
|
limit_rate_after 512k;
|
|
|
|
limit_rate $limit_rate;
|
|
|
|
|
|
|
|
proxy_read_timeout 600;
|
|
|
|
proxy_set_header User-Agent: Sia-Agent;
|
|
|
|
|
2022-03-11 08:10:12 +00:00
|
|
|
proxy_pass http://sia:9980/skynet/skylink/$skylink$path$is_args$args;
|