nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

commit 9b302bb6204530110bbe21f4f051c1d08c3f9ee4
parent 1b9b6a61cc84c8023b5d134ff6d9e735413201c4
Author: mtmn <miro@haravara.org>
Date:   Mon,  4 May 2026 18:51:56 +0200

fix: caddy redirs on errors

Diffstat:
Mmodules/services/static.nix | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/modules/services/static.nix b/modules/services/static.nix @@ -35,11 +35,8 @@ in { lib.nameValuePair domain { extraConfig = '' - handle_errors { - redir / 302 - } - - handle / { + @root path / + handle @root { route { rewrite * /${opt.bucket}/index.html reverse_proxy https://${opt.endpoint} @@ -51,7 +48,13 @@ in { handle { route { rewrite * /${opt.bucket}{http.request.uri.path} - reverse_proxy https://${opt.endpoint} + reverse_proxy https://${opt.endpoint} { + @error status 5xx 4xx + handle_response @error { + header Location / + respond "" 302 + } + } } } '';