/skynet/pin endpoint

This commit is contained in:
Karol Wypchlo 2021-06-02 17:56:35 +02:00
parent 45ce3de7c2
commit ece2025561
1 changed files with 19 additions and 0 deletions

View File

@ -402,6 +402,25 @@ server {
proxy_redirect https://siad/ https://$domain.$tld/;
}
location /skynet/pin {
include /etc/nginx/conf.d/include/cors;
# Extract 2 sets of 2 characters from $request_id and assign to $dir1, $dir2
# respectfully. The rest of the $request_id is going to be assigned to $dir3.
# We use those variables to automatically generate a unique path for the uploaded file.
# This ensures that not all uploaded files end up in the same directory, which is something
# that causes performance issues in the renter.
# Example path result: /af/24/9bc5ec894920ccc45634dc9a8065
if ($request_id ~* "(\w{2})(\w{2})(\w+)") {
set $dir1 $1;
set $dir2 $2;
set $dir3 $3;
}
proxy_set_header User-Agent: Sia-Agent;
proxy_pass http://siad$uri?siapath=$dir/$dir2/$dir3&$args;
}
location /skynet/metadata {
include /etc/nginx/conf.d/include/cors;