Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Content-Type for some JSON responses like 404's #3354

Closed
matrixbot opened this issue Nov 2, 2024 · 1 comment
Closed

Wrong Content-Type for some JSON responses like 404's #3354

matrixbot opened this issue Nov 2, 2024 · 1 comment

Comments

@matrixbot
Copy link
Collaborator

This issue was originally created by @morguldir at matrix-org/dendrite#3354.

Reported-By: @roughnecks

Background information

  • dendrite.matrix.org
  • Dendrite version or git SHA: 0.13.6+87f028d
  • Client used (if applicable): Element Web >= 1.11.60

Description

  • What is the problem: Dendrite returns the wrong content type for 404 M_UNKNOWN, text/plain, for example for /_matrix/client/unstable/org.matrix.msc2965/auth_issuer
  • Who is affected: People using Dendrite with Element Web, or anyone else requiring json as the content type
  • How is this bug manifesting: Element tells you "your Element is misconfigured"
  • When did this first appear: Element Web 1.11.60, i suspect the return type hasn't been important before though

Steps to reproduce

  • go to app.element.io
  • set server to dendrite.matrix.org
  • observe the error

Headers

curl https://dendrite.matrix.org/_matrix/client/unstable/org.matrix.msc2965/auth_issuer -I
HTTP/2 404 
date: Sun, 07 Apr 2024 14:16:16 GMT
content-type: text/plain; charset=utf-8
content-length: 59
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
strict-transport-security: max-age=15724800; includeSubDomains
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 870aa26e0a396661-AMS

Explanation

the content is fine, but the Content-Type header must be application/json as per the spec: https://spec.matrix.org/v1.10/client-server-api/#api-standards

Servers must include a Content-Type header of application/json for all JSON responses.

- Michael (t3chguy) => https://matrix.to/#/!YTvKGNlinIzlkMTVRl:matrix.org/$Ccl7mmAOGI8KhBJ0BzOM63Wje1gcmh2IX6tAchUXXZ8?via=matrix.org&via=privacytools.io&via=mozilla.org

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @roughnecks at matrix-org/dendrite#3354 (comment).

Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant