From 39fe05dec00a81a87b5826e0f82421909d9038eb Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sat, 31 May 2025 17:04:16 +0000 Subject: [PATCH] nixos/lasuite-docs: fix media proxying --- nixos/modules/services/web-apps/lasuite-docs.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/web-apps/lasuite-docs.nix b/nixos/modules/services/web-apps/lasuite-docs.nix index eb1c44c2e87b..b18ba8a1abf6 100644 --- a/nixos/modules/services/web-apps/lasuite-docs.nix +++ b/nixos/modules/services/web-apps/lasuite-docs.nix @@ -9,6 +9,7 @@ let inherit (lib) getExe mapAttrs + match mkEnableOption mkIf mkPackageOption @@ -32,6 +33,8 @@ let toString value ) cfg.settings; + proxySuffix = if match "unix:.*" cfg.bind != null then ":" else ""; + commonServiceConfig = { RuntimeDirectory = "lasuite-docs"; StateDirectory = "lasuite-docs"; @@ -476,10 +479,9 @@ in }; locations."/media-auth" = { - proxyPass = "http://${cfg.bind}"; + proxyPass = "http://${cfg.bind}${proxySuffix}/api/v1.0/documents/media-auth/"; recommendedProxySettings = true; extraConfig = '' - rewrite $/(.*)^ /api/v1.0/documents/$1 break; proxy_set_header X-Original-URL $request_uri; proxy_pass_request_body off; proxy_set_header Content-Length ""; @@ -489,7 +491,6 @@ in locations."/media/" = { proxyPass = cfg.s3Url; - recommendedProxySettings = true; extraConfig = '' auth_request /media-auth; auth_request_set $authHeader $upstream_http_authorization;