Merge pull request #1452 from ad35cm/well-known-headers

This commit is contained in:
Ben Banfield-Zanin authored and GitHub committed 2026-07-17 08:20:45 +01:00
commit 5b3035baa8
6 files changed
+46 -11

No files matched your search

@@ -1,6 +1,6 @@
{{- /*
Copyright 2024-2025 New Vector Ltd
Copyright 2025 Element Creations Ltd
Copyright 2025-2026 Element Creations Ltd
SPDX-License-Identifier: AGPL-3.0-only
*/ -}}
@@ -47,15 +47,9 @@ frontend well-known-in
backend well-known-static
mode http
http-after-response set-header X-Frame-Options SAMEORIGIN
http-after-response set-header X-Content-Type-Options nosniff
http-after-response set-header X-XSS-Protection "1; mode=block"
http-after-response set-header Content-Security-Policy "frame-ancestors 'self'"
http-after-response set-header X-Robots-Tag "noindex, nofollow, noarchive, noimageindex"
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 "X-Requested-With, Content-Type, Authorization"
{{- range $name, $value := .headers }}
http-after-response set-header {{ $name }} {{ $value | quote }}
{{- end }}
http-request return status 200 content-type "application/json" file "/well-known/server" if { path /.well-known/matrix/server }
http-request return status 200 content-type "application/json" file "/well-known/client" if { path /.well-known/matrix/client }
@@ -36,6 +36,12 @@
"type": "string"
}
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
@@ -1,6 +1,6 @@
{#
Copyright 2024-2025 New Vector Ltd
Copyright 2025 Element Creations Ltd
Copyright 2025-2026 Element Creations Ltd
SPDX-License-Identifier: AGPL-3.0-only
#}
@@ -24,3 +24,17 @@ additional:
client: "{}"
server: "{}"
support: "{}"
## Headers to return on the /.well-known/matrix/* responses
## Additional headers can be added and the default headers can be
## modified or removed (by setting their value to null)
headers:
Access-Control-Allow-Headers: "X-Requested-With, Content-Type, Authorization"
Access-Control-Allow-Methods: "GET, POST, PUT, DELETE, OPTIONS"
Access-Control-Allow-Origin: "*"
Cache-Control: "public, max-age=3600"
Content-Security-Policy: "frame-ancestors 'self'"
X-Content-Type-Options: "nosniff"
X-Frame-Options: "SAMEORIGIN"
X-Robots-Tag: "noindex, nofollow, noarchive, noimageindex"
X-XSS-Protection: "1; mode=block"
+6
View File
@@ -27283,6 +27283,12 @@
}
},
"additionalProperties": false
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
+14
View File
@@ -5709,3 +5709,17 @@ wellKnownDelegation:
client: "{}"
server: "{}"
support: "{}"
## Headers to return on the /.well-known/matrix/* responses
## Additional headers can be added and the default headers can be
## modified or removed (by setting their value to null)
headers:
Access-Control-Allow-Headers: "X-Requested-With, Content-Type, Authorization"
Access-Control-Allow-Methods: "GET, POST, PUT, DELETE, OPTIONS"
Access-Control-Allow-Origin: "*"
Cache-Control: "public, max-age=3600"
Content-Security-Policy: "frame-ancestors 'self'"
X-Content-Type-Options: "nosniff"
X-Frame-Options: "SAMEORIGIN"
X-Robots-Tag: "noindex, nofollow, noarchive, noimageindex"
X-XSS-Protection: "1; mode=block"
+1
View File
@@ -0,0 +1 @@
Allow customising the response headers of the `/.well-known/matrix/*` endpoints via `wellKnownDelegation.headers`. The well-known responses now return `Cache-Control: public, max-age=3600` by default.