synapse proxy

This commit is contained in:
Tristan 2024-02-17 17:06:11 +00:00
parent e5f9966329
commit e7f3e1ba7c
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,45 @@
let
fqdn = "${hostname}.${domain}";
domain = "tristans.cloud";
hostname = "matrix";
mkWellKnown = data: ''
default_type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON data}';
'';
in
{
services.matrix-synapse = {
enable = false; # using podman for the moment
};
services.nginx.virtualHosts = {
${domain} = {
locations."= /.well-known/matrix/server".extraConfig = mkWellKnown {
"m.server" = "${fqdn}:443";
};
locations."= /.well-known/matrix/client".extraConfig = mkWellKnown {
"m.homeserver".base_url = "https://${fqdn}";
"org.matrix.msc3575.proxy"."url" = "https://${fqdn}";
};
locations."= /.well-known/matrix/support".extraConfig = mkWellKnown {
admins = [{
matrix_id = "@tristan:tristans.cloud";
email_address = "tristan@tristans.cloud";
role = "admin";
}];
};
locations."/_matrix".proxyPass = "http://localhost:8008";
locations."/_synapse/client".proxyPass = "http://localhost:8008";
locations."/_matrix/client/unstable/org.matrix.msc3575/sync".proxyPass =
"http://localhost:8009";
};
${fqdn} = {
enableACME = true;
forceSSL = true;
locations."/_matrix".proxyPass = "http://localhost:8008";
locations."/_synapse/client".proxyPass = "http://localhost:8008";
locations."/_matrix/client/unstable/org.matrix.msc3575/sync".proxyPass =
"http://localhost:8009";
};
};
}