From 6e45456fece5ce0cbf8d93fd1def4fa446070bf5 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 2 Apr 2025 17:06:13 +0100 Subject: [PATCH] fix(ops/machines/snix-cache): support old /nar/tvix-castore URLs Nix clients still might have old .narinfo files cached, containing old NAR URLs. Send a redirect to the new URL. Fixes: #103 Change-Id: Ie3b77e4fdc4be0f982e023f2a2acd3f9f0257f9b Reviewed-on: https://cl.snix.dev/c/snix/+/30291 Autosubmit: Florian Klink Tested-by: besadii Reviewed-by: edef --- ops/machines/snix-cache/nar-bridge.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ops/machines/snix-cache/nar-bridge.nix b/ops/machines/snix-cache/nar-bridge.nix index 37f714b96..d8e8ec383 100644 --- a/ops/machines/snix-cache/nar-bridge.nix +++ b/ops/machines/snix-cache/nar-bridge.nix @@ -41,6 +41,11 @@ proxy_cache_use_stale error timeout updating; ''; }; + # Rewrite old nar/tvix-castore/…?narsize=… requests to the new URL + # Clients keep these paths in their narinfo cache annoyingly long. + locations."/nar/tvix-castore".extraConfig = '' + rewrite ^/nar/tvix-castore/(.*)$ /nar/snix-castore/$1 redirect; + ''; }; # use more cores for compression