Merge branch 'master' into accounts
# Conflicts: # docker/nginx/conf.d/client.conf
This commit is contained in:
commit
2891191137
|
@ -1,4 +1,4 @@
|
||||||
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=skynet:10m max_size=10g use_temp_path=off;
|
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=skynet:10m max_size=10g inactive=24h use_temp_path=off;
|
||||||
|
|
||||||
# ratelimit specified IPs
|
# ratelimit specified IPs
|
||||||
geo $limit {
|
geo $limit {
|
||||||
|
@ -276,21 +276,20 @@ server {
|
||||||
proxy_set_header Expect $http_expect;
|
proxy_set_header Expect $http_expect;
|
||||||
proxy_set_header User-Agent: Sia-Agent;
|
proxy_set_header User-Agent: Sia-Agent;
|
||||||
|
|
||||||
# Extract 3 sets of 2 characters from $request_id and assign to $dir1, $dir2, $dir3
|
# 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 $dir4.
|
# 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.
|
# 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
|
# This ensures that not all uploaded files end up in the same directory, which is something
|
||||||
# that causes performance issues in the renter.
|
# that causes performance issues in the renter.
|
||||||
# Example path result: /af/24/9b/c5ec894920ccc45634dc9a8065
|
# Example path result: /af/24/9bc5ec894920ccc45634dc9a8065
|
||||||
if ($request_id ~* "(\w{2})(\w{2})(\w{2})(\w+)") {
|
if ($request_id ~* "(\w{2})(\w{2})(\w+)") {
|
||||||
set $dir1 $1;
|
set $dir1 $1;
|
||||||
set $dir2 $2;
|
set $dir2 $2;
|
||||||
set $dir3 $3;
|
set $dir3 $3;
|
||||||
set $dir4 $4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# proxy this call to siad endpoint (make sure the ip is correct)
|
# proxy this call to siad endpoint (make sure the ip is correct)
|
||||||
proxy_pass http://siad/skynet/skyfile/$dir1/$dir2/$dir3/$dir4$is_args$args;
|
proxy_pass http://siad/skynet/skyfile/$dir1/$dir2/$dir3$is_args$args;
|
||||||
|
|
||||||
# register the upload in accounts service (cookies should contain jwt)
|
# register the upload in accounts service (cookies should contain jwt)
|
||||||
log_by_lua_block {
|
log_by_lua_block {
|
||||||
|
|
|
@ -11,4 +11,4 @@ if ($request_method = 'OPTIONS') {
|
||||||
more_set_headers 'Access-Control-Allow-Origin: *';
|
more_set_headers 'Access-Control-Allow-Origin: *';
|
||||||
more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE';
|
more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE';
|
||||||
more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||||
more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range,Skynet-File-Metadata';
|
more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range,Skynet-File-Metadata,Skynet-Skylink';
|
||||||
|
|
|
@ -5,5 +5,6 @@ proxy_set_header Range $slice_range; # pass slice range to proxy
|
||||||
proxy_cache_key $uri$arg_format$arg_attachment$slice_range; # use just the uri path, format and attachment args and slice range
|
proxy_cache_key $uri$arg_format$arg_attachment$slice_range; # use just the uri path, format and attachment args and slice range
|
||||||
proxy_cache_min_uses 3; # cache responses after 3 requests of the same file
|
proxy_cache_min_uses 3; # cache responses after 3 requests of the same file
|
||||||
proxy_cache_valid 200 206 24h; # cache 200 and 206 responses for 24 hours
|
proxy_cache_valid 200 206 24h; # cache 200 and 206 responses for 24 hours
|
||||||
|
proxy_cache_lock on; # queue cache requests for the same resource until it is fully cached
|
||||||
proxy_cache_bypass $cookie_nocache $arg_nocache; # add cache bypass option
|
proxy_cache_bypass $cookie_nocache $arg_nocache; # add cache bypass option
|
||||||
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses
|
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses
|
||||||
|
|
|
@ -40,7 +40,9 @@ http {
|
||||||
'"$http_user_agent" $upstream_response_time '
|
'"$http_user_agent" $upstream_response_time '
|
||||||
'$upstream_bytes_sent $upstream_bytes_received '
|
'$upstream_bytes_sent $upstream_bytes_received '
|
||||||
'"$upstream_http_content_type" "$upstream_cache_status" '
|
'"$upstream_http_content_type" "$upstream_cache_status" '
|
||||||
'"$portal_domain" "$upstream_http_skynet_skylink"';
|
'"$portal_domain" "$upstream_http_skynet_skylink" '
|
||||||
|
'$upstream_connect_time $upstream_header_time '
|
||||||
|
'$request_time "$hns_domain"';
|
||||||
|
|
||||||
access_log logs/access.log main;
|
access_log logs/access.log main;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ fi
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# iterate through all servers, block the skylinks and purge it from cache
|
# iterate through all servers, block the skylinks and purge it from cache
|
||||||
#########################################################################
|
#########################################################################
|
||||||
for server in "germany.siasky.net" "helsinki.siasky.net" "us-west.siasky.net" "us-va-1.siasky.net" "us-pa-1.siasky.net" "us-pa-2.siasky.net" "siasky.xyz";
|
for server in "eu-ger-1.siasky.net" "eu-ger-2.siasky.net" "eu-fin-1.siasky.net" "us-or-1.siasky.net" "us-or-2.siasky.net" "us-va-1.siasky.net" "us-pa-1.siasky.net" "us-pa-2.siasky.net" "siasky.xyz";
|
||||||
do
|
do
|
||||||
for skylink in "${skylinks[@]}";
|
for skylink in "${skylinks[@]}";
|
||||||
do
|
do
|
||||||
|
|
Reference in New Issue