.well-known CORS headers needed #16

Open
opened 2 years ago by cel · 1 comments
cel commented 2 years ago
Owner

Attempting to sign in at https://app.element.io/#/login results in error "Unexpected error resolving homeserver configuration"
Developer Tools (Network) shows CORS Missing Allow Origin for https://woodbine.nyc/.well-known/matrix/client
This might be the cause of #11.
The headers for the .well-known should be fixed to enable login from third-party-hosted clients.

Attempting to sign in at https://app.element.io/#/login results in error "Unexpected error resolving homeserver configuration" Developer Tools (Network) shows CORS Missing Allow Origin for https://woodbine.nyc/.well-known/matrix/client This might be the cause of #11. The headers for the .well-known should be fixed to enable login from third-party-hosted clients.
cel commented 2 years ago
Poster
Owner

Fix:

diff --git a/nginx/nginx/templates/chat.conf.template b/nginx/nginx/templates/chat.conf.template
index 54da46c..11b7246 100644
--- a/nginx/nginx/templates/chat.conf.template
+++ b/nginx/nginx/templates/chat.conf.template
@@ -48,11 +48,13 @@ server {
        # serve the static content for the well known files
        location /.well-known/matrix/server {
                default_type application/json;
+               add_header Access-Control-Allow-Origin *;
                return 200 '{"m.server": "${MATRIX_HOSTNAME}:443"}';
        }

        location /.well-known/matrix/client {
                default_type application/json;
+               add_header Access-Control-Allow-Origin *;
                return 200 '{"m.homeserver":{"base_url": "https://${MATRIX_HOSTNAME}"}}';
        }
Fix: ```diff diff --git a/nginx/nginx/templates/chat.conf.template b/nginx/nginx/templates/chat.conf.template index 54da46c..11b7246 100644 --- a/nginx/nginx/templates/chat.conf.template +++ b/nginx/nginx/templates/chat.conf.template @@ -48,11 +48,13 @@ server { # serve the static content for the well known files location /.well-known/matrix/server { default_type application/json; + add_header Access-Control-Allow-Origin *; return 200 '{"m.server": "${MATRIX_HOSTNAME}:443"}'; } location /.well-known/matrix/client { default_type application/json; + add_header Access-Control-Allow-Origin *; return 200 '{"m.homeserver":{"base_url": "https://${MATRIX_HOSTNAME}"}}'; } ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: cel/hackerspace-zone-mirror#16
Loading…
There is no content yet.