From 2a266f69e8c978c440d512d8f8f952d2ff40ded9 Mon Sep 17 00:00:00 2001 From: Lzebulon Date: Tue, 8 Apr 2025 22:43:49 +0200 Subject: [PATCH] Fix media + infiny loop with auth --- modules/services/matrix.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/services/matrix.nix b/modules/services/matrix.nix index 66bd71d..f2654c2 100644 --- a/modules/services/matrix.nix +++ b/modules/services/matrix.nix @@ -55,13 +55,15 @@ report_stats = false; + public_baseurl = "https://matrix.crans.org/"; + listeners = [ { port = 8008; tls = false; bind_addresses = [ - "::" - "0.0.0.0" + "::1" + "127.0.0.1" ]; type = "http"; x_forwarded = true; @@ -199,5 +201,17 @@ proxy_set_header Host $host; ''; }; + + locations."/media" = { + proxyPass = "http://localhost:11111"; + extraConfig = '' + rewrite ^/media(.*)$ $1 break; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + ''; + }; + + }; }