mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
chore(access): tweak redirects
This commit is contained in:
parent
2c764ddf9a
commit
ee5dc7aef2
6 changed files with 16 additions and 14 deletions
|
|
@ -201,12 +201,14 @@
|
|||
"/" = mkIf cfg.requireAuth {
|
||||
vouch.requireAuth = mkAlmostOptionDefault true;
|
||||
};
|
||||
${cfg.auth.errorLocation} = mkIf (cfg.auth.errorLocation != null) {
|
||||
${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;
|
||||
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;
|
||||
'';
|
||||
return = mkDefault "303 '${loginUrl}'";
|
||||
};
|
||||
in mkIf (cfg.auth.errorLocation != null) errorLocation;
|
||||
${cfg.auth.requestLocation} = {
|
||||
config,
|
||||
xvars,
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ in {
|
|||
locations =
|
||||
{
|
||||
"/" = {
|
||||
return = "302 /kitchen/";
|
||||
return = "307 /kitchen/";
|
||||
};
|
||||
"/kitchen" = {
|
||||
proxy = {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue