diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 90c6c668..abc739d9 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -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 geo $limit { @@ -276,21 +276,20 @@ server { proxy_set_header Expect $http_expect; proxy_set_header User-Agent: Sia-Agent; - # 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. + # 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/9b/c5ec894920ccc45634dc9a8065 - if ($request_id ~* "(\w{2})(\w{2})(\w{2})(\w+)") { + # Example path result: /af/24/9bc5ec894920ccc45634dc9a8065 + if ($request_id ~* "(\w{2})(\w{2})(\w+)") { set $dir1 $1; set $dir2 $2; set $dir3 $3; - set $dir4 $4; } # 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) log_by_lua_block { diff --git a/docker/nginx/conf.d/include/cors b/docker/nginx/conf.d/include/cors index 818ac28d..add176d2 100644 --- a/docker/nginx/conf.d/include/cors +++ b/docker/nginx/conf.d/include/cors @@ -11,4 +11,4 @@ if ($request_method = 'OPTIONS') { 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-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'; diff --git a/docker/nginx/conf.d/include/proxy-cache-downloads b/docker/nginx/conf.d/include/proxy-cache-downloads index f3f82a5f..b1eb83f3 100644 --- a/docker/nginx/conf.d/include/proxy-cache-downloads +++ b/docker/nginx/conf.d/include/proxy-cache-downloads @@ -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_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_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 add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index a266943d..4cff1f70 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -40,7 +40,9 @@ http { '"$http_user_agent" $upstream_response_time ' '$upstream_bytes_sent $upstream_bytes_received ' '"$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; diff --git a/scripts/blocklist-skylink.sh b/scripts/blocklist-skylink.sh index 1f7dabfb..17e0ae66 100755 --- a/scripts/blocklist-skylink.sh +++ b/scripts/blocklist-skylink.sh @@ -32,7 +32,7 @@ fi ######################################################################### # 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 for skylink in "${skylinks[@]}"; do