From a8e1b41a8f2a7b557e6cc4d0d85ed766f6eb94bf Mon Sep 17 00:00:00 2001 From: x4u <14617923-x4u@users.noreply.gitlab.com> Date: Thu, 10 Aug 2023 15:38:14 +0800 Subject: [PATCH 1/3] Enable well_known_client_route --- src/api/client_server/unversioned.rs | 4 +--- src/main.rs | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/client_server/unversioned.rs b/src/api/client_server/unversioned.rs index 797b9529..84e58d5c 100644 --- a/src/api/client_server/unversioned.rs +++ b/src/api/client_server/unversioned.rs @@ -34,9 +34,7 @@ pub async fn get_supported_versions_route( } /// # `GET /.well-known/matrix/client` -pub async fn well_known_client_route( - _body: Ruma, -) -> Result { +pub async fn well_known_client_route() -> Result { let client_url = match services().globals.well_known_client() { Some(url) => url.clone(), None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")), diff --git a/src/main.rs b/src/main.rs index c74d6ddb..def28381 100644 --- a/src/main.rs +++ b/src/main.rs @@ -435,6 +435,10 @@ fn routes() -> Router { "/_matrix/client/v3/rooms/:room_id/initialSync", get(initial_sync), ) + .route( + "/.well-known/matrix/client", + get(client_server::well_known_client_route), + ) .route("/", get(it_works)) .fallback(not_found) } -- 2.45.2 From 911c8d9df43ebf50a2ce611a5fd7434d78fdd2c5 Mon Sep 17 00:00:00 2001 From: x4u <14617923-x4u@users.noreply.gitlab.com> Date: Thu, 10 Aug 2023 15:52:17 +0800 Subject: [PATCH 2/3] Add reverse proxy entries --- DEPLOY.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DEPLOY.md b/DEPLOY.md index cb318eee..29390bdf 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -225,6 +225,8 @@ ServerName your.server.name # EDIT THIS AllowEncodedSlashes NoDecode ProxyPass /_matrix/ http://127.0.0.1:6167/_matrix/ timeout=300 nocanon ProxyPassReverse /_matrix/ http://127.0.0.1:6167/_matrix/ +ProxyPass /.well-known/ http://127.0.0.1:6167/.well-known/ timeout=300 nocanon +ProxyPassReverse /.well-known/ http://127.0.0.1:6167/.well-known/ ``` @@ -246,6 +248,7 @@ Create `/etc/caddy/conf.d/conduit_caddyfile` and enter this (substitute for your ```caddy your.server.name, your.server.name:8448 { reverse_proxy /_matrix/* 127.0.0.1:6167 + reverse_proxy /.well-known/* 127.0.0.1:6167 } ``` @@ -279,6 +282,13 @@ server { proxy_read_timeout 5m; } + location /.well-known/ { + proxy_pass http://127.0.0.1:6167$request_uri; + proxy_set_header Host $http_host; + proxy_buffering off; + proxy_read_timeout 5m; + } + ssl_certificate /etc/letsencrypt/live/your.server.name/fullchain.pem; # EDIT THIS ssl_certificate_key /etc/letsencrypt/live/your.server.name/privkey.pem; # EDIT THIS ssl_trusted_certificate /etc/letsencrypt/live/your.server.name/chain.pem; # EDIT THIS -- 2.45.2 From 179e66974687d73bef5111b09fc5ac51ee3c0031 Mon Sep 17 00:00:00 2001 From: x4u <14617923-x4u@users.noreply.gitlab.com> Date: Mon, 14 Aug 2023 08:08:15 +0800 Subject: [PATCH 3/3] Proxy only .well-known/matrix/client --- DEPLOY.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DEPLOY.md b/DEPLOY.md index 29390bdf..399edb48 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -225,8 +225,9 @@ ServerName your.server.name # EDIT THIS AllowEncodedSlashes NoDecode ProxyPass /_matrix/ http://127.0.0.1:6167/_matrix/ timeout=300 nocanon ProxyPassReverse /_matrix/ http://127.0.0.1:6167/_matrix/ -ProxyPass /.well-known/ http://127.0.0.1:6167/.well-known/ timeout=300 nocanon -ProxyPassReverse /.well-known/ http://127.0.0.1:6167/.well-known/ + + ProxyPass http://127.0.0.1:6167/.well-known/matrix/client timeout=300 nocanon + ``` @@ -248,7 +249,7 @@ Create `/etc/caddy/conf.d/conduit_caddyfile` and enter this (substitute for your ```caddy your.server.name, your.server.name:8448 { reverse_proxy /_matrix/* 127.0.0.1:6167 - reverse_proxy /.well-known/* 127.0.0.1:6167 + reverse_proxy /.well-known/matrix/client 127.0.0.1:6167 } ``` @@ -282,7 +283,7 @@ server { proxy_read_timeout 5m; } - location /.well-known/ { + location /.well-known/matrix/client { proxy_pass http://127.0.0.1:6167$request_uri; proxy_set_header Host $http_host; proxy_buffering off; -- 2.45.2