fix api calls that define their own siapath
This commit is contained in:
parent
beb486d33a
commit
de1c3e0035
|
@ -59,6 +59,8 @@ server {
|
||||||
limit_conn uploads_by_ip 10; # ddos protection: max 10 uploads at a time
|
limit_conn uploads_by_ip 10; # ddos protection: max 10 uploads at a time
|
||||||
client_max_body_size 1000M; # make sure to limit the size of upload to a sane value
|
client_max_body_size 1000M; # make sure to limit the size of upload to a sane value
|
||||||
proxy_read_timeout 600;
|
proxy_read_timeout 600;
|
||||||
|
proxy_request_buffering off; # stream uploaded files through the proxy as it comes in
|
||||||
|
proxy_set_header Expect $http_expect;
|
||||||
|
|
||||||
# Extract 3 sets of 2 characters from $request_id and assign to $dir1, $dir2, $dir3
|
# Extract 3 sets of 2 characters from $request_id and assign to $dir1, $dir2, $dir3
|
||||||
# respectfully. The rest of the $request_id is going to be assigned to $dir4.
|
# respectfully. The rest of the $request_id is going to be assigned to $dir4.
|
||||||
|
@ -84,7 +86,38 @@ server {
|
||||||
# you do not want to run your portal in the double siad setup.
|
# you do not want to run your portal in the double siad setup.
|
||||||
proxy_pass http://127.0.0.1:9970/skynet/skyfile/$dir1/$dir2/$dir3/$dir4$is_args$args;
|
proxy_pass http://127.0.0.1:9970/skynet/skyfile/$dir1/$dir2/$dir3/$dir4$is_args$args;
|
||||||
|
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
|
proxy_hide_header Access-Control-Allow-Origin;
|
||||||
|
# make sure to override user agent header - siad requirement
|
||||||
|
proxy_set_header User-Agent: Sia-Agent;
|
||||||
|
# replace BASE64_AUTHENTICATION with base64 encoded <user>:<password>
|
||||||
|
# for sia user is empty so it's just :<password>
|
||||||
|
# to generate the passcode use https://www.base64encode.org or any other base64 encoder
|
||||||
|
proxy_set_header Authorization "Basic BASE64_AUTHENTICATION";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ "/skynet/skyfile/(.*)" {
|
||||||
|
limit_conn uploads_by_ip 10; # ddos protection: max 10 uploads at a time
|
||||||
|
client_max_body_size 1000M; # make sure to limit the size of upload to a sane value
|
||||||
|
proxy_read_timeout 600;
|
||||||
|
proxy_request_buffering off; # stream uploaded files through the proxy as it comes in
|
||||||
proxy_set_header Expect $http_expect;
|
proxy_set_header Expect $http_expect;
|
||||||
|
|
||||||
|
# we need to explicitly use set directive here because $1 will contain the siapath with
|
||||||
|
# decoded whitespaces and set will re-encode it for us before passing it to proxy_pass
|
||||||
|
set $siapath $1;
|
||||||
|
|
||||||
|
# proxy this call to siad endpoint (make sure the ip is correct)
|
||||||
|
#
|
||||||
|
# note that we point uploads to port '9970', do this when you want to
|
||||||
|
# run in a configuration where you have two siad instances, one for
|
||||||
|
# downloads and one for uploads. This drastically improves the up - and
|
||||||
|
# download speed of your portal. When running your portal in this double
|
||||||
|
# siad setup, make sure only the download portal runs in 'portal mode'.
|
||||||
|
# The upload siad can be run in normal mode. Set the port to '9980' if
|
||||||
|
# you do not want to run your portal in the double siad setup.
|
||||||
|
proxy_pass http://127.0.0.1:9970/skynet/skyfile/$siapath$is_args$args;
|
||||||
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
add_header Access-Control-Allow-Origin *;
|
||||||
proxy_hide_header Access-Control-Allow-Origin;
|
proxy_hide_header Access-Control-Allow-Origin;
|
||||||
# make sure to override user agent header - siad requirement
|
# make sure to override user agent header - siad requirement
|
||||||
|
|
Reference in New Issue