From 394e933ee1f85a112fb8354eb3cfd3f1646285ca Mon Sep 17 00:00:00 2001 From: villepeh <100730729+villepeh@users.noreply.github.com> Date: Tue, 19 Apr 2022 17:49:58 +0300 Subject: [PATCH 1/5] HAProxy delegation example --- docs/reverse_proxy.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/reverse_proxy.md b/docs/reverse_proxy.md index 5a0c847951a6..b392442a91ca 100644 --- a/docs/reverse_proxy.md +++ b/docs/reverse_proxy.md @@ -206,6 +206,29 @@ backend matrix server matrix 127.0.0.1:8008 ``` + +[Delegation](delegate.md) example: +``` +frontend https + acl wellknownc path /.well-known/matrix/client + acl wellknowns path /.well-known/matrix/server + use_backend WKcli if wellknownc + use_backend WKserv if wellknowns + +backend WKcli + http-after-response set-header Access-Control-Allow-Origin "*" + http-after-response set-header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" + http-after-response set-header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" + http-request return status 200 content-type application/json string '{"m.homeserver":{"base_url":"https://matrix.example.com"}}' + +backend WKserv + http-after-response set-header Access-Control-Allow-Origin "*" + http-after-response set-header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" + http-after-response set-header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" + http-request return status 200 content-type application/json string '{"m.server":"matrix.example.com:443"}' + +``` + ### Relayd ``` From 532052aa7b55e73a39c2143a4fee2dc932c68f23 Mon Sep 17 00:00:00 2001 From: villepeh <100730729+villepeh@users.noreply.github.com> Date: Tue, 19 Apr 2022 17:50:43 +0300 Subject: [PATCH 2/5] HAProxy delegation example --- docs/reverse_proxy.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/reverse_proxy.md b/docs/reverse_proxy.md index b392442a91ca..0a7a5b08b4c2 100644 --- a/docs/reverse_proxy.md +++ b/docs/reverse_proxy.md @@ -226,7 +226,6 @@ backend WKserv http-after-response set-header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" http-after-response set-header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" http-request return status 200 content-type application/json string '{"m.server":"matrix.example.com:443"}' - ``` ### Relayd From f452d5b7f477e35d915355c31215d01449492999 Mon Sep 17 00:00:00 2001 From: villepeh <100730729+villepeh@users.noreply.github.com> Date: Tue, 19 Apr 2022 17:57:06 +0300 Subject: [PATCH 3/5] Create 12501.doc --- changelog.d/12501.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/12501.doc diff --git a/changelog.d/12501.doc b/changelog.d/12501.doc new file mode 100644 index 000000000000..109476e6263f --- /dev/null +++ b/changelog.d/12501.doc @@ -0,0 +1 @@ +HAProxy delegation example with CORS headers. From cc1b9cd71ca466afe30e358615aae61d409a4169 Mon Sep 17 00:00:00 2001 From: villepeh <100730729+villepeh@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:29:56 +0300 Subject: [PATCH 4/5] Consistent naming style Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> --- docs/reverse_proxy.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/reverse_proxy.md b/docs/reverse_proxy.md index 0a7a5b08b4c2..69caa8a73ee8 100644 --- a/docs/reverse_proxy.md +++ b/docs/reverse_proxy.md @@ -210,18 +210,18 @@ backend matrix [Delegation](delegate.md) example: ``` frontend https - acl wellknownc path /.well-known/matrix/client - acl wellknowns path /.well-known/matrix/server - use_backend WKcli if wellknownc - use_backend WKserv if wellknowns + acl matrix-well-known-client-path path /.well-known/matrix/client + acl matrix-well-known-server-path path /.well-known/matrix/server + use_backend matrix-well-known-client if matrix-well-known-client-path + use_backend matrix-well-known-server if matrix-well-known-server-path -backend WKcli +backend matrix-well-known-client http-after-response set-header Access-Control-Allow-Origin "*" http-after-response set-header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" http-after-response set-header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" - http-request return status 200 content-type application/json string '{"m.homeserver":{"base_url":"https://matrix.example.com"}}' + http-request return status 200 content-type application/json string '{"m.homeserver":{"base_url":"https://matrix.example.com"},"m.identity_server":{"base_url":"https://identity.example.com"}}' -backend WKserv +backend matrix-well-known-server http-after-response set-header Access-Control-Allow-Origin "*" http-after-response set-header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" http-after-response set-header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" From 8dab0da17febd3ef7ce566d3758c253bebedf52c Mon Sep 17 00:00:00 2001 From: villepeh <100730729+villepeh@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:31:01 +0300 Subject: [PATCH 5/5] make changelog clearer Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> --- changelog.d/12501.doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/12501.doc b/changelog.d/12501.doc index 109476e6263f..278193a69a31 100644 --- a/changelog.d/12501.doc +++ b/changelog.d/12501.doc @@ -1 +1 @@ -HAProxy delegation example with CORS headers. +Add HAProxy delegation example with CORS headers to docs.