diff --git a/.well-known/matrix/client b/.well-known/matrix/client.json similarity index 100% rename from .well-known/matrix/client rename to .well-known/matrix/client.json diff --git a/.well-known/matrix/server b/.well-known/matrix/server.json similarity index 100% rename from .well-known/matrix/server rename to .well-known/matrix/server.json diff --git a/README.md b/README.md index b882990..228dd7c 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Matrix-Discovery-Dateien unter `.well-known/matrix/` bereit. - Dunkle, responsive Landingpage ohne externe Frameworks - Klassische statische Dateien: `index.html`, `style.css`, `script.js` - Matrix Homeserver Discovery: - - `/.well-known/matrix/server` - - `/.well-known/matrix/client` + - `/.well-known/matrix/server` aus `.well-known/matrix/server.json` + - `/.well-known/matrix/client` aus `.well-known/matrix/client.json` - Dockerfile fuer eine einfache Nginx-Auslieferung ## Matrix @@ -28,7 +28,9 @@ Matrix-Discovery-Dateien unter `.well-known/matrix/` bereit. {"m.homeserver":{"base_url":"https://matrix.rastus01.com"}} ``` -Wichtig: Diese Dateien haben absichtlich keine `.json`-Dateiendung. +Die Dateien liegen im Repository mit `.json`-Dateiendung. Nginx liefert die +Matrix-Discovery-Endpunkte weiterhin ohne `.json` aus, damit Clients die +standardisierten URLs finden. ## Lokal mit Docker diff --git a/nginx.conf b/nginx.conf index 3800f5c..fe9a50a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -10,6 +10,12 @@ server { } location = /.well-known/matrix/server { + default_type application/json; + add_header Access-Control-Allow-Origin "*" always; + try_files /.well-known/matrix/server.json =404; + } + + location = /.well-known/matrix/server.json { default_type application/json; add_header Access-Control-Allow-Origin "*" always; try_files $uri =404; @@ -25,6 +31,19 @@ server { return 204; } + try_files /.well-known/matrix/client.json =404; + } + + location = /.well-known/matrix/client.json { + default_type application/json; + add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Methods "GET, OPTIONS" always; + add_header Access-Control-Allow-Headers "Content-Type" always; + + if ($request_method = OPTIONS) { + return 204; + } + try_files $uri =404; }