This commit is contained in:
Ivaylo Novakov 2022-03-14 17:48:07 +01:00
parent 79c205c298
commit 902de07aec
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
1 changed files with 5 additions and 5 deletions

View File

@ -5,10 +5,10 @@ include /etc/nginx/conf.d/include/track-download;
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
#### 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
###set_by_lua_block $skylink { return require("skynet.skylink").parse(ngx.var.skylink) } 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: ###$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 #### 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 #### b) skylink v2 - in a lua block below we will resolve the skylink v2 into skylink v1 and update
@ -115,5 +115,5 @@ 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 # 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 # 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 # we need to rewrite the skylink v1 to skylink v2 in the location header with proxy_redirect
###proxy_redirect $skylink_v1 $skylink_v2; 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_v1$path$is_args$args;