diff --git a/charts/matrix-synapse/templates/ingress.yaml b/charts/matrix-synapse/templates/ingress.yaml index 4995931..82bc1ff 100644 --- a/charts/matrix-synapse/templates/ingress.yaml +++ b/charts/matrix-synapse/templates/ingress.yaml @@ -109,17 +109,21 @@ spec: {{- end }} {{- if has . $wkHosts }} + {{- if $.Values.wellknown.enabled }} - path: /.well-known/matrix/client backend: - serviceName: {{ $fullName }} - servicePort: 8008 - - {{- if $.Values.wellknown.enabled }} + serviceName: {{ $wkName }} + servicePort: 80 - path: /.well-known/matrix/server backend: serviceName: {{ $wkName }} servicePort: 80 - {{- end }} + {{- else }} + - path: /.well-known/matrix/client + backend: + serviceName: {{ $fullName }} + servicePort: 8008 + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/matrix-synapse/templates/well-known-config.yaml b/charts/matrix-synapse/templates/well-known-config.yaml index 0d4a98a..8b9cef1 100644 --- a/charts/matrix-synapse/templates/well-known-config.yaml +++ b/charts/matrix-synapse/templates/well-known-config.yaml @@ -23,12 +23,11 @@ data: server.groupname = "lighttpd" server.document-root = {{ .Values.wellknown.htdocsPath | quote }} server.pid-file = "/run/lighttpd.pid" - server.errorlog = "/dev/stderr" url.rewrite-once = ( + "^/\.well-known/matrix/client" => "/client.json", "^/\.well-known/matrix/server" => "/server.json" ) status.status-url = "/server-status" - accesslog.filename = "/dev/stderr" extforward.forwarder = ( "all" => "trust") setenv.add-response-header = ( "access-control-allow-headers" => "Origin, X-Requested-With, Content-Type, Accept, Authorization", @@ -39,5 +38,15 @@ data: "content-type" => "application/json" ) server.json: |- +{{- if .Values.wellknown.server }} +{{ toJson .Values.wellknown.server | nindent 4 }} +{{- else }} {{ dict "m.server" (printf "%s:%d" (.Values.wellknown.host | default (.Values.publicServerName | default .Values.serverName)) (.Values.wellknown.port | default 443)) | toJson | indent 4 }} -{{- end }} +{{- end }} + client.json: |- +{{- if .Values.wellknown.client }} +{{ toJson .Values.wellknown.client | nindent 4 }} +{{- else }} +{{ dict "m.homeserver" (dict "base_url" (printf "https://%s/" (.Values.publicServerName | default .Values.serverName))) | toJson | indent 4 }} +{{- end }} +{{- end -}} diff --git a/charts/matrix-synapse/templates/well-known.yaml b/charts/matrix-synapse/templates/well-known.yaml index 2d4e4b6..d00c0eb 100644 --- a/charts/matrix-synapse/templates/well-known.yaml +++ b/charts/matrix-synapse/templates/well-known.yaml @@ -64,6 +64,9 @@ spec: - mountPath: /etc/lighttpd/lighttpd.conf name: files subPath: lighttpd.conf + - mountPath: {{ .Values.wellknown.htdocsPath }}/client.json + name: files + subPath: client.json - mountPath: {{ .Values.wellknown.htdocsPath }}/server.json name: files subPath: server.json diff --git a/charts/matrix-synapse/values.yaml b/charts/matrix-synapse/values.yaml index b7f455e..6fc386a 100644 --- a/charts/matrix-synapse/values.yaml +++ b/charts/matrix-synapse/values.yaml @@ -456,8 +456,14 @@ wellknown: ## The host and port combo to serve on .well-known/matrix/server. ## - # host: matrix.example.com - # port: 443 + server: {} + # m.server: matrix.example.com:443 + + ## Data to serve on .well-known/matrix/client. + ## + client: {} + # m.homeserver: + # base_url: https://matrix.example.com ## A custom htdocs path, useful when running another image. ##