From 87e6e8c7a901ef88619c56257e43afc04f708f26 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 30 Jul 2020 16:38:09 +0200 Subject: [PATCH] add Cache-Control to skynet links --- docker-compose.yml | 2 +- docker/nginx/conf.d/client.conf | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 727040d2..1ddf3058 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 3c964b78..bd7bedc1 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -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; } }