diff --git a/modules/nixos/nginx/vouch.nix b/modules/nixos/nginx/vouch.nix index 15af376d..d7a8028f 100644 --- a/modules/nixos/nginx/vouch.nix +++ b/modules/nixos/nginx/vouch.nix @@ -201,12 +201,14 @@ "/" = mkIf cfg.requireAuth { vouch.requireAuth = mkAlmostOptionDefault true; }; - ${cfg.auth.errorLocation} = mkIf (cfg.auth.errorLocation != null) { - xvars.enable = true; - extraConfig = '' - return 302 $vouch_url/login?url=${xvars.get.scheme}://${xvars.get.host}$request_uri&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err; - ''; - }; + ${cfg.auth.errorLocation} = let + errorLocation = { xvars, ... }: let + loginUrl = "$vouch_url/login?url=${xvars.get.scheme}://${xvars.get.host}$request_uri&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err"; + in { + xvars.enable = true; + return = mkDefault "303 '${loginUrl}'"; + }; + in mkIf (cfg.auth.errorLocation != null) errorLocation; ${cfg.auth.requestLocation} = { config, xvars, diff --git a/nixos/access/gensokyo/minecraft.nix b/nixos/access/gensokyo/minecraft.nix index 01277b72..00b74034 100644 --- a/nixos/access/gensokyo/minecraft.nix +++ b/nixos/access/gensokyo/minecraft.nix @@ -69,7 +69,7 @@ in { inherit root extraConfig; }; "/minecraft/wiki" = { - return = "302 https://wiki.${domain}/minecraft/"; + return = "301 https://wiki.${domain}/minecraft/"; }; "~ '^/minecraft/modpack/(\\S*)$'" = { return = ''308 "https://gensokyo-zone.github.io/minecraft-modpack/$1"''; @@ -80,7 +80,7 @@ in { then "bmap" else "dmap"; in { - return = "302 /minecraft/${defaultMap}/"; + return = "308 /minecraft/${defaultMap}/"; }; "/minecraft/dmap/" = mkIf minecraft.ports.dynmap.enable { proxy = { diff --git a/nixos/access/kitchencam.nix b/nixos/access/kitchencam.nix index 895aa351..5b0f021f 100644 --- a/nixos/access/kitchencam.nix +++ b/nixos/access/kitchencam.nix @@ -82,7 +82,7 @@ in { locations = { "/" = { - return = "302 /kitchen/"; + return = "307 /kitchen/"; }; "/kitchen" = { proxy = { diff --git a/nixos/access/moonraker.nix b/nixos/access/moonraker.nix index 4e4bba82..60750611 100644 --- a/nixos/access/moonraker.nix +++ b/nixos/access/moonraker.nix @@ -53,7 +53,7 @@ in { headers.set.Cache-Control = "no-store, no-cache, must-revalidate"; }; "/webcam" = { - return = "302 /webcam/stream"; + return = "307 /webcam/stream"; }; "/webcam/stream" = { proxy = { diff --git a/nixos/access/nextjs-ollama.nix b/nixos/access/nextjs-ollama.nix index cfa2f12e..4805f55e 100644 --- a/nixos/access/nextjs-ollama.nix +++ b/nixos/access/nextjs-ollama.nix @@ -47,7 +47,7 @@ in { }; locations = { "~ ^/llama$" = { - return = mkDefault "302 /llama/"; + return = mkDefault "308 /llama/"; }; "/llama/" = {virtualHost, ...}: { imports = [proxyLocation]; @@ -62,12 +62,12 @@ in { imports = [proxyLocation]; }; "~ '^/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'" = { - return = mkDefault "302 /llama$request_uri"; + return = mkDefault "307 /llama$request_uri"; }; "/" = {virtualHost, ...}: { extraConfig = mkBefore '' if ($http_referer ~ '^https?://${escapeRegex virtualHost.serverName}/llama/') { - return 302 /llama$request_uri; + return 307 /llama$request_uri; } ''; return = mkDefault "404"; diff --git a/nixos/access/proxmox.nix b/nixos/access/proxmox.nix index 97eff709..4dd33358 100644 --- a/nixos/access/proxmox.nix +++ b/nixos/access/proxmox.nix @@ -31,7 +31,7 @@ in { set $prox_plain $1; } if ($prox_plain = $prox_expected) { - return 302 https://$host/$prox_plain/; + return 307 https://$host/$prox_plain/; } if ($prox_plain != ''') { rewrite /(.*) /prox/$1 last;