Allow accessing .well-known files cross-origin
Matrix clients like https://app.element.io need to be able to read these urls in
order to know where our matrix server is. Therefore, we've added a Header
directive to helpers which can add arbitrary headers as well as a special
"CrossOrigin" helper to directly add a "Header" with
Access-Control-Allow-Origin *.
Change-Id: I0e1f04ff71b3d42992a06f080cc8cd77d7134376
Signed-off-by: Skyler Grey <minion@clicks.codes>
Reviewed-on: https://git.clicks.codes/c/Clicks/NixFiles/+/41
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git a/modules/common/nginx-routes.nix b/modules/common/nginx-routes.nix
index b5f2abc..e218469 100644
--- a/modules/common/nginx-routes.nix
+++ b/modules/common/nginx-routes.nix
@@ -9,7 +9,7 @@
(ReverseProxy "127.0.0.1:5000"))
(Host "clicks.codes" (Compose [
(Path "/.well-known/matrix/"
- (File ./nginx/clicks.codes/.well-known/matrix))
+ (CrossOrigin (File ./nginx/clicks.codes/.well-known/matrix)))
(ReverseProxy "127.0.0.1:3000")
]))
(Hosts [ "vaultwarden.clicks.codes" "passwords.clicks.codes" ] (ReverseProxy "generic:1028"))
@@ -70,7 +70,7 @@
(Path "/nucleus/" (ReverseProxy "SamuelDesktop:10000")))
(Host "coded.codes" (Compose [
(Path "/.well-known/matrix/"
- (File ./nginx/clicks.codes/.well-known/matrix))
+ (CrossOrigin (File ./nginx/clicks.codes/.well-known/matrix)))
(Redirect "https://clicks.codes$request_uri")
]))
(Hosts ["matrix-backend.clicks.codes" "matrix-backend.coded.codes"] (Compose [