From 56f9a0cdb05d1bf8dc5060987c4ff46c80453821 Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Sat, 30 Aug 2025 15:16:09 +0100 Subject: [PATCH] matrix-synapse: add recommended proxy config --- hosts/vps1/matrix.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hosts/vps1/matrix.nix b/hosts/vps1/matrix.nix index 7fc3891..a0deb2b 100644 --- a/hosts/vps1/matrix.nix +++ b/hosts/vps1/matrix.nix @@ -51,6 +51,14 @@ let domain = serverName; }; }; + proxyConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + ''; in { networking.firewall.allowedTCPPorts = [ @@ -100,14 +108,11 @@ in locations = { "/" = { proxyPass = "http://localhost:8008"; - extraConfig = '' - proxy_set_header X-Forwarded-For $remote_addr; - ''; + extraConfig = proxyConfig; }; "/_matrix" = { proxyPass = "http://localhost:8008"; - extraConfig = '' - proxy_set_header X-Forwarded-For $remote_addr; + extraConfig = proxyConfig + '' client_max_body_size 50M; ''; };