add Cache-Control to skynet links

This commit is contained in:
Karol Wypchlo 2020-07-30 16:38:09 +02:00
parent e30fa02142
commit 87e6e8c7a9
2 changed files with 5 additions and 1 deletions

View File

@ -21,7 +21,7 @@ services:
env_file:
- .env
volumes:
- ./docker/data/sia:/sia-data
- /Users/karol/Library/ApplicationSupport/Sia-UI/sia:/sia-data
networks:
- shared
expose:

View File

@ -176,6 +176,7 @@ server {
include /etc/nginx/conf.d/include/cors;
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
add_header Cache-Control "public, max-age=31536000, immutable"; # allow consumer to cache response
# we need to explicitly use set directive here because $1 will contain the skylink with
# decoded whitespaces and set will re-encode it for us before passing it to proxy_pass
@ -196,12 +197,14 @@ server {
proxy_cache_min_uses 10;
proxy_cache_valid 200 1440m;
proxy_cache_bypass $cookie_nocache $arg_nocache; # add cache bypass option
add_header X-Proxy-Cache $upstream_cache_status;
}
location ~ "^/file/([a-zA-Z0-9-_]{46}(/.*)?)$" {
include /etc/nginx/conf.d/include/cors;
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
add_header Cache-Control "public, max-age=31536000, immutable"; # allow consumer to cache response
# we need to explicitly use set directive here because $1 will contain the skylink with
# decoded whitespaces and set will re-encode it for us before passing it to proxy_pass
@ -223,5 +226,6 @@ server {
proxy_cache_min_uses 10;
proxy_cache_valid 200 1440m;
proxy_cache_bypass $cookie_nocache $arg_nocache; # add cache bypass option
add_header X-Proxy-Cache $upstream_cache_status;
}
}