Skip to content

Commit 0013b48

Browse files
authored
Merge pull request #641 from element-hq/bbz/remove-well-known-element
Remove support for `/.well-known/element/element.json`
2 parents 0d3a30c + 19f5e24 commit 0013b48

File tree

16 files changed

+32
-59
lines changed

16 files changed

+32
-59
lines changed

charts/matrix-stack/ci/test-cluster-mixin.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
certManager:
1010
clusterIssuer: ess-selfsigned
1111

12+
ingress:
13+
controllerType: ingress-nginx
14+
1215
matrixRTC:
1316
# Because the authoriser service won't trust certificates issued by the above self-signed CA
1417
extraEnv:

charts/matrix-stack/configs/haproxy/haproxy.cfg.tpl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- /*
2-
Copyright 2024 New Vector Ltd
2+
Copyright 2024-2025 New Vector Ltd
33
44
SPDX-License-Identifier: AGPL-3.0-only
55
*/ -}}
@@ -66,16 +66,6 @@ defaults
6666
compression algo gzip
6767
compression type text/plain text/html text/xml application/json text/css
6868

69-
# if we hit the maxconn on a server, and the queue timeout expires, we want
70-
# to avoid returning 503, since that will cause cloudflare to mark us down.
71-
#
72-
# https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#1.3.1 says:
73-
#
74-
# 503 when no server was available to handle the request, or in response to
75-
# monitoring requests which match the "monitor fail" condition
76-
#
77-
errorfile 503 /usr/local/etc/haproxy/429.http
78-
7969
# Use a consistent hashing scheme so that worker with balancing going down doesn't cause
8070
# the traffic for all others to be shuffled around.
8171
hash-type consistent sdbm

charts/matrix-stack/configs/haproxy/429.http.tpl renamed to charts/matrix-stack/configs/synapse/429.http.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- /*
2-
Copyright 2024 New Vector Ltd
2+
Copyright 2024-2025 New Vector Ltd
33
44
SPDX-License-Identifier: AGPL-3.0-only
55
*/ -}}

charts/matrix-stack/configs/synapse/partial-haproxy.cfg.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ frontend synapse-http-in
2525
# same as http log, with %Th (handshake time)
2626
log-format "%ci:%cp [%tr] %ft %b/%s %Th/%TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
2727

28+
# if we hit the maxconn on a server, and the queue timeout expires, we want
29+
# to avoid returning 503, since that will cause cloudflare to mark us down.
30+
#
31+
# https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#1.3.1 says:
32+
#
33+
# 503 when no server was available to handle the request, or in response to
34+
# monitoring requests which match the "monitor fail" condition
35+
#
36+
errorfile 503 /synapse/429.http
37+
2838
capture request header Host len 32
2939
capture request header Referer len 200
3040
capture request header User-Agent len 200

charts/matrix-stack/configs/well-known/partial-haproxy.cfg.tpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ frontend well-known-in
1919
acl well-known path /.well-known/matrix/server
2020
acl well-known path /.well-known/matrix/client
2121
acl well-known path /.well-known/matrix/support
22-
acl well-known path /.well-known/element/element.json
2322

2423
{{ if .baseDomainRedirect.enabled }}
2524
{{- if $root.Values.elementWeb.enabled }}
@@ -33,6 +32,7 @@ frontend well-known-in
3332
{{- end }}
3433

3534
use_backend well-known-static if well-known
35+
default_backend well-known-no-match
3636

3737
backend well-known-static
3838
mode http
@@ -50,6 +50,10 @@ backend well-known-static
5050
http-request return status 200 content-type "application/json" file "/well-known/server" if { path /.well-known/matrix/server }
5151
http-request return status 200 content-type "application/json" file "/well-known/client" if { path /.well-known/matrix/client }
5252
http-request return status 200 content-type "application/json" file "/well-known/support" if { path /.well-known/matrix/support }
53-
http-request return status 200 content-type "application/json" file "/well-known/element.json" if { path /.well-known/element/element.json }
53+
54+
backend well-known-no-match
55+
mode http
56+
57+
http-request deny status 404
5458

5559
{{- end -}}

charts/matrix-stack/source/wellKnownDelegation.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
"client": {
3030
"type": "string"
3131
},
32-
"element": {
33-
"type": "string"
34-
},
3532
"server": {
3633
"type": "string"
3734
},

charts/matrix-stack/source/wellKnownDelegation.yaml.j2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{#
2-
Copyright 2024 New Vector Ltd
2+
Copyright 2024-2025 New Vector Ltd
33
44
SPDX-License-Identifier: AGPL-3.0-only
55
#}
@@ -22,5 +22,4 @@ baseDomainRedirect:
2222
additional:
2323
client: "{}"
2424
server: "{}"
25-
element: "{}"
2625
support: "{}"

charts/matrix-stack/templates/haproxy/_helpers.tpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ app.kubernetes.io/version: {{ include "element-io.ess-library.labels.makeSafe" .
2020
{{- with required "element-io.haproxy.configmap-data missing context" .context -}}
2121
haproxy.cfg: |
2222
{{- tpl ($root.Files.Get "configs/haproxy/haproxy.cfg.tpl") (dict "root" $root "context" .) | nindent 2 }}
23-
429.http: |
24-
{{- (tpl ($root.Files.Get "configs/haproxy/429.http.tpl") dict) | nindent 2 }}
2523
{{- end -}}
2624
{{- end -}}
2725

charts/matrix-stack/templates/synapse/_helpers.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ redis.conf: |
223223

224224
{{- define "element-io.synapse-haproxy.configmap-data" -}}
225225
{{- $root := .root -}}
226+
429.http: |
227+
{{- (tpl ($root.Files.Get "configs/haproxy/429.http.tpl") dict) | nindent 2 }}
226228
path_map_file: |
227229
{{- (tpl ($root.Files.Get "configs/synapse/path_map_file.tpl") (dict "root" $root)) | nindent 2 }}
228230
path_map_file_get: |

charts/matrix-stack/templates/well-known/_helpers.tpl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ k8s.element.io/target-instance: {{ $root.Release.Name }}-haproxy
8080
{{- end -}}
8181
{{- end }}
8282

83-
{{- define "element-io.well-known-delegation.element" }}
84-
{{- $root := .root -}}
85-
{{- with required "element-io.well-known-delegation.element missing context" .context -}}
86-
{{- $config := dict -}}
87-
{{- $additional := .additional.element | fromJson -}}
88-
{{- tpl (toPrettyJson (mustMergeOverwrite $additional $config)) $root -}}
89-
{{- end -}}
90-
{{- end }}
91-
9283
{{- define "element-io.well-known-delegation.support" }}
9384
{{- $root := .root -}}
9485
{{- with required "element-io.well-known-delegation.support missing context" .context -}}
@@ -107,7 +98,5 @@ server: |
10798
{{- (tpl (include "element-io.well-known-delegation.server" (dict "root" $root "context" .)) $root) | nindent 2 }}
10899
support: |
109100
{{- (tpl (include "element-io.well-known-delegation.support" (dict "root" $root "context" .)) $root) | nindent 2 }}
110-
element.json: |
111-
{{- (tpl (include "element-io.well-known-delegation.element" (dict "root" $root "context" .)) $root) | nindent 2 }}
112101
{{- end -}}
113102
{{- end -}}

0 commit comments

Comments
 (0)