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/flake.lock b/flake.lock
index 734a178..926437a 100644
--- a/flake.lock
+++ b/flake.lock
@@ -59,11 +59,11 @@
         "nixpkgs": "nixpkgs_2"
       },
       "locked": {
-        "lastModified": 1700411817,
-        "narHash": "sha256-XWKavCk0KdgMfyoyCqerRXl5gqk0IKItw7QQFTGDpAY=",
+        "lastModified": 1700606678,
+        "narHash": "sha256-ZqkMRyAdrP7czMlOTqgZluaEvCRcwEGLRY9FZra/Yz8=",
         "ref": "refs/heads/main",
-        "rev": "9b2bb0dd0662e26ea5c9b7bcd2c767b50abc4525",
-        "revCount": 18,
+        "rev": "8b911b96cd322f9a3741d382cca30894617e4dad",
+        "revCount": 19,
         "type": "git",
         "url": "https://git.clicks.codes/Clicks/NixHelpers"
       },
diff --git a/helpers b/helpers
index 9b2bb0d..8044f5e 160000
--- a/helpers
+++ b/helpers
@@ -1 +1 @@
-Subproject commit 9b2bb0dd0662e26ea5c9b7bcd2c767b50abc4525
+Subproject commit 8044f5eb5d7dec0b3d194f2fafe634fb0c60d8c2
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 [