Forward acme requests for banditlair.com

This commit is contained in:
Paul-Henri Froidmont 2021-09-13 15:33:38 +02:00
parent df9573573c
commit f0ff9d3a9f
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE

View file

@ -4,7 +4,7 @@ let
let let
join = hostName: domain: hostName + lib.optionalString (domain != null) ".${domain}"; join = hostName: domain: hostName + lib.optionalString (domain != null) ".${domain}";
in in
join "matrix" config.networking.domain; join "matrix" config.networking.domain;
in in
{ {
security.acme.email = "letsencrypt.account@banditlair.com"; security.acme.email = "letsencrypt.account@banditlair.com";
@ -18,6 +18,7 @@ in
"${config.networking.domain}" = { "${config.networking.domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
acmeFallbackHost = "storage1.banditlair.com";
locations."= /.well-known/matrix/server".extraConfig = locations."= /.well-known/matrix/server".extraConfig =
let let
@ -25,10 +26,10 @@ in
# the client-server and server-server port for simplicity # the client-server and server-server port for simplicity
server = { "m.server" = "${fqdn}:443"; }; server = { "m.server" = "${fqdn}:443"; };
in in
'' ''
add_header Content-Type application/json; add_header Content-Type application/json;
return 200 '${builtins.toJSON server}'; return 200 '${builtins.toJSON server}';
''; '';
locations."= /.well-known/matrix/client".extraConfig = locations."= /.well-known/matrix/client".extraConfig =
let let
client = { client = {
@ -37,11 +38,11 @@ in
}; };
# ACAO required to allow element-web on any URL to request this json file # ACAO required to allow element-web on any URL to request this json file
in in
'' ''
add_header Content-Type application/json; add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}'; return 200 '${builtins.toJSON client}';
''; '';
}; };
# Reverse proxy for Matrix client-server and server-server communication # Reverse proxy for Matrix client-server and server-server communication