From 161a4ae838555e5fddfd52cec98899cfcd543a5d Mon Sep 17 00:00:00 2001 From: Fugi Date: Sun, 6 Oct 2024 16:54:32 +0200 Subject: [PATCH] ese website caching --- modules/web/ese.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/web/ese.nix b/modules/web/ese.nix index 4763b4a..acea225 100644 --- a/modules/web/ese.nix +++ b/modules/web/ese.nix @@ -6,12 +6,20 @@ in services.nginx = { virtualHosts."${domain}" = { locations."= /" = { - return = "301 /2024/"; + # temporary redirect, to avoid caching problems + return = "302 /2024/"; }; locations."/" = { root = "/srv/web/ese/served"; tryFiles = "$uri $uri/ =404"; }; + # cache static assets + locations."~* \.(?:css|svg|webp|jpg|jpeg|gif|png|ico|mp4|mp3|ogg|ogv|webm|ttf|woff2|woff)$" = { + root = "/srv/web/ese/served"; + extraConfig = '' + expires 1y; + ''; + }; }; }; }