add Cache-Control to skynet links
This commit is contained in:
parent
e30fa02142
commit
87e6e8c7a9
|
@ -21,7 +21,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/data/sia:/sia-data
|
- /Users/karol/Library/ApplicationSupport/Sia-UI/sia:/sia-data
|
||||||
networks:
|
networks:
|
||||||
- shared
|
- shared
|
||||||
expose:
|
expose:
|
||||||
|
|
|
@ -176,6 +176,7 @@ server {
|
||||||
include /etc/nginx/conf.d/include/cors;
|
include /etc/nginx/conf.d/include/cors;
|
||||||
|
|
||||||
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
|
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
|
# 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
|
# 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_min_uses 10;
|
||||||
proxy_cache_valid 200 1440m;
|
proxy_cache_valid 200 1440m;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ "^/file/([a-zA-Z0-9-_]{46}(/.*)?)$" {
|
location ~ "^/file/([a-zA-Z0-9-_]{46}(/.*)?)$" {
|
||||||
include /etc/nginx/conf.d/include/cors;
|
include /etc/nginx/conf.d/include/cors;
|
||||||
|
|
||||||
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
|
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
|
# 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
|
# 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_min_uses 10;
|
||||||
proxy_cache_valid 200 1440m;
|
proxy_cache_valid 200 1440m;
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue