Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
INSTALL: Fix setting content-type on well-known (#8793)
Browse files Browse the repository at this point in the history
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 <daenney@users.noreply.github.com>
  • Loading branch information
daenney authored Nov 23, 2020
1 parent 476b8c0 commit 8ca120d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ In nginx this would be something like:
```
location /.well-known/matrix/client {
return 200 '{"m.homeserver": {"base_url": "https://<matrix.example.com>"}}';
add_header Content-Type application/json;
default_type application/json;
add_header Access-Control-Allow-Origin *;
}
```
Expand Down
1 change: 1 addition & 0 deletions changelog.d/8793.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the example on how to set the `Content-Type` header in nginx for the Client Well-Known URI.

0 comments on commit 8ca120d

Please sign in to comment.