matrix-synapse: add recommended proxy config

This commit is contained in:
2025-08-30 15:16:09 +01:00
parent 34585223ca
commit 56f9a0cdb0

View File

@@ -51,6 +51,14 @@ let
domain = serverName; 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 in
{ {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
@@ -100,14 +108,11 @@ in
locations = { locations = {
"/" = { "/" = {
proxyPass = "http://localhost:8008"; proxyPass = "http://localhost:8008";
extraConfig = '' extraConfig = proxyConfig;
proxy_set_header X-Forwarded-For $remote_addr;
'';
}; };
"/_matrix" = { "/_matrix" = {
proxyPass = "http://localhost:8008"; proxyPass = "http://localhost:8008";
extraConfig = '' extraConfig = proxyConfig + ''
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 50M; client_max_body_size 50M;
''; '';
}; };