From 25bdaacaab33317c8fba1cbff0617375a3f7c78c Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Tue, 19 Mar 2024 13:30:42 -0300 Subject: [PATCH] use stale-while-revalidate to cache less agressively --- hosts/alcyone/services/website/default.nix | 4 ++-- hosts/alcyone/services/website/themes.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hosts/alcyone/services/website/default.nix b/hosts/alcyone/services/website/default.nix index 85e8428a..bf7f14f1 100644 --- a/hosts/alcyone/services/website/default.nix +++ b/hosts/alcyone/services/website/default.nix @@ -23,13 +23,13 @@ in "/" = { root = "${website}/public"; extraConfig = '' - add_header Cache-Control "max-age=${toString (minutes 15)}"; + add_header Cache-Control "max-age=${toString (minutes 5)}, stale-while-revalidate=${toString (minutes 15)}"; ''; }; "/assets/" = { root = "${website}/public"; extraConfig = '' - add_header Cache-Control "max-age=${toString (days 30)}"; + add_header Cache-Control "max-age=${toString (hours 1)}, stale-while-revalidate=${toString (days 30)}"; ''; }; diff --git a/hosts/alcyone/services/website/themes.nix b/hosts/alcyone/services/website/themes.nix index a81ea706..ddf090e0 100644 --- a/hosts/alcyone/services/website/themes.nix +++ b/hosts/alcyone/services/website/themes.nix @@ -59,7 +59,7 @@ in root = themes; extraConfig = '' add_header Access-Control-Allow-Origin *; - add_header Cache-Control "max-age=${days 30}"; + add_header Cache-Control "max-age=${days 1}, stale-while-revalidate=${days 30}"; ''; }; };