From 8dc8b55e0f3ff7ac2fee01123b666344e58fa9ea Mon Sep 17 00:00:00 2001 From: Daniele Sluijters Date: Sat, 21 Nov 2020 14:41:33 +0100 Subject: [PATCH 1/2] INSTALL: Fix setting content-type on well-known When using `add_header` nginx will literally add a header. If a `content-type` header is already configured (for example through a server wide default), this means we end up with 2 content-type headers, like so: ``` content-type: text/html content-type: application/json access-control-allow-origin: * ``` That doesn't make sense. Instead, we want the content type of that block to only be `application/json` which we can achieve using `default_type` instead. Signed-off-by: Daniele Sluijters --- INSTALL.md | 2 +- changelog.d/8793.doc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/8793.doc diff --git a/INSTALL.md b/INSTALL.md index c6fcb3bd7f2a..47415a4eb2aa 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -487,7 +487,7 @@ In nginx this would be something like: ``` location /.well-known/matrix/client { return 200 '{"m.homeserver": {"base_url": "https://"}}'; - add_header Content-Type application/json; + default_type "application/json"; add_header Access-Control-Allow-Origin *; } ``` diff --git a/changelog.d/8793.doc b/changelog.d/8793.doc new file mode 100644 index 000000000000..6bce522d0164 --- /dev/null +++ b/changelog.d/8793.doc @@ -0,0 +1 @@ +Fixed the example on how to set the `Content-Type` header in nginx for Client Well-Known URI. From e0e9dfbb79c8dcff9790803a748d05ecdc977f3f Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Mon, 23 Nov 2020 13:00:44 +0000 Subject: [PATCH 2/2] Apply suggestions from code review --- INSTALL.md | 2 +- changelog.d/8793.doc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 47415a4eb2aa..eaeb6900929f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -487,7 +487,7 @@ In nginx this would be something like: ``` location /.well-known/matrix/client { return 200 '{"m.homeserver": {"base_url": "https://"}}'; - default_type "application/json"; + default_type application/json; add_header Access-Control-Allow-Origin *; } ``` diff --git a/changelog.d/8793.doc b/changelog.d/8793.doc index 6bce522d0164..f6eee1ea735c 100644 --- a/changelog.d/8793.doc +++ b/changelog.d/8793.doc @@ -1 +1 @@ -Fixed the example on how to set the `Content-Type` header in nginx for Client Well-Known URI. +Fix the example on how to set the `Content-Type` header in nginx for the Client Well-Known URI.