close
Skip to content

MSC4402: Consistent redirects for .well-known-files#4402

Open
derhagen wants to merge 6 commits into
matrix-org:mainfrom
derhagen:main
Open

MSC4402: Consistent redirects for .well-known-files#4402
derhagen wants to merge 6 commits into
matrix-org:mainfrom
derhagen:main

Conversation

@derhagen
Copy link
Copy Markdown

@derhagen derhagen commented Jan 15, 2026

@derhagen derhagen changed the title Add MSC: Consistent redirects for .well-known-files MSC4402: Consistent redirects for .well-known-files Jan 15, 2026
@derhagen derhagen marked this pull request as ready for review January 15, 2026 16:02
Comment thread proposals/4402-consistent-redirects-for-well-known-files.md Outdated
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Jan 15, 2026
Copy link
Copy Markdown
Member

@turt2live turt2live Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Web client (following redirect)
  • Native/non-web client (following redirect)
  • Server (issuing redirect on client API)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only thing that needs to be implemented is the Clients following redirects.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like me to include this in the MSC?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thread is part of the MSC process rather than a suggestion. In order for the MSC to be considered for merging, appropriate implementations have to be linked in this comment thread (not in the markdown file)

I think in this case the first two bullets might have been a misinterpretation of the MSC though, because the MSC doesn't touch federation .well-known, it just references that as something which already supports redirects.

Copy link
Copy Markdown
Member

@tulir tulir Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the list to remove the server following redirect parts and split the client into two items, because web clients and native clients work fairly differently (web clients tend to always follow redirects, but all redirects must have CORS. Native clients may need to implement redirect following manually, but they don't care about CORS)

(also, implementations can just be confirming that something already works and perhaps pointing to the relevant existing code rather than writing new code)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, but you can even remove "Server (issuing redirect on client API)" I guess. In this scenario, the redirect would be set up manually by whoever has access to the webserver behind the base domain.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just logged in to mozilla.org using Element Web, Fluffychat Web, as well as native GNOME Fractal. After creating a fresh account, I went through the login process with each mentioned client, and also went through key recovery until I was presented with an empty chat list. It worked as expected on all tested clients. The homeserver I specified was always mozilla.org.

Note that mozilla.org already serves a 301 response under .well-known/matrix/client, as proposed in this MSC.

For the record:

$ curl -I https://mozilla.org/.well-known/matrix/client

HTTP/2 301 
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: max-age=3600
content-length: 162
content-type: text/html
date: Wed, 11 Mar 2026 15:30:50 GMT
location: https://www.mozilla.org/.well-known/matrix/client
server: nginx
x-backend-server: TS
via: 1.1 google
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some extra testing with another instance serving a 307 response. Everything worked as expected using Element Web, Fluffychat Web, Cinny Web, as well as native GNOME Fractal. The hostname I specified was always *redacted*.eu

$ curl https://*redacted*.eu/.well-known/matrix/client -I
HTTP/2 307 
access-control-allow-origin: *
location: https://matrix.*redacted*.eu/.well-known/matrix/client
content-length: 18
date: Tue, 24 Mar 2026 16:12:54 GMT

@turt2live turt2live added s2s Server-to-Server API (federation) client-server Client-Server API and removed client-server Client-Server API labels Jan 15, 2026
Copy link
Copy Markdown
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't really read the MSC in too much detail, but "this is breaking" sounds scary 😬

This review is for an early pass of the checklist.

Comment thread proposals/4402-consistent-redirects-for-well-known-files.md Outdated
Comment thread proposals/4402-consistent-redirects-for-well-known-files.md
Comment thread proposals/4402-consistent-redirects-for-well-known-files.md Outdated
Signed-off-by: Hagen Echzell <2806328+derhagen@users.noreply.github.com>
Signed-off-by: Hagen Echzell <2806328+derhagen@users.noreply.github.com>
Signed-off-by: Hagen Echzell <2806328+derhagen@users.noreply.github.com>
@derhagen
Copy link
Copy Markdown
Author

I haven't really read the MSC in too much detail, but "this is breaking" sounds scary 😬

Note that it only breaks backwards-compatibility for server-client interaction and only in settings where the admin explicitly chooses to make use of a well-known-redirect. Since the new wording is "Clients should follow 30x redirects", admins are made aware that a redirect might not work with all clients.

In enterprise settings, this doesn't matter, because a server admin mandates the client to use, anyway. Server admins who can't mandate the client need to wait with using redirects until this change has been broadly implemented.

@derhagen derhagen requested a review from turt2live January 16, 2026 11:23
Comment thread proposals/4402-consistent-redirects-for-well-known-files.md
Signed-off-by: Hagen Echzell <2806328+derhagen@users.noreply.github.com>
Signed-off-by: Hagen Echzell <2806328+derhagen@users.noreply.github.com>
@turt2live
Copy link
Copy Markdown
Member

The author believes this MSC is ready for FCP. Implementations need checking.

ref

@turt2live turt2live added implementation-needs-checking The MSC has an implementation, but the SCT has not yet checked it. and removed needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Mar 11, 2026
@github-project-automation github-project-automation Bot moved this to Tracking for review in Spec Core Team Workflow Mar 11, 2026
@turt2live turt2live moved this from Tracking for review to Proposed for FCP readiness in Spec Core Team Workflow Mar 11, 2026
@derhagen
Copy link
Copy Markdown
Author

derhagen commented Mar 12, 2026

The author believes this MSC is ready for FCP. Implementations need checking.

ref

See #4402 (comment) for my notes on checking implementations.

Copy link
Copy Markdown
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks ready for proposed-FCP, thanks!

My comments are non-blocking for FCP to start.

Comment thread proposals/4402-consistent-redirects-for-well-known-files.md
@turt2live turt2live added 00-weekly-pings Tracking for weekly pings in the SCT office. 00 to make it first in the labels list. and removed implementation-needs-checking The MSC has an implementation, but the SCT has not yet checked it. labels Mar 23, 2026
@turt2live
Copy link
Copy Markdown
Member

MSCs proposed for Final Comment Period (FCP) should meet the requirements outlined in the checklist prior to being accepted into the spec. This checklist is a bit long, but aims to reduce the number of follow-on MSCs after a feature lands.

SCT members: please check off things you check for, and raise a concern against FCP if the checklist is incomplete. If an item doesn't apply, prefer to check it rather than remove it. Unchecking items is encouraged where applicable.

MSC authors: feel free to ask in a thread on your MSC or in the#matrix-spec:matrix.org room for clarification of any of these points.

  • Are appropriate implementation(s) specified in the MSC’s PR description?
  • Are all MSCs that this MSC depends on already accepted?
  • For each new endpoint that is introduced:
    • Have authentication requirements been specified?
    • Have rate-limiting requirements been specified?
    • Have guest access requirements been specified?
    • Are error responses specified?
      • Does each error case have a specified errcode (e.g. M_FORBIDDEN) and HTTP status code?
        • If a new errcode is introduced, is it clear that it is new?
  • Will the MSC require a new room version, and if so, has that been made clear?
    • Is the reason for a new room version clearly stated? For example, modifying the set of redacted fields changes how event IDs are calculated, thus requiring a new room version.
  • Are backwards-compatibility concerns appropriately addressed?
  • Are the endpoint conventions honoured?
    • Do HTTP endpoints use_underscores_like_this?
    • Will the endpoint return unbounded data? If so, has pagination been considered?
    • If the endpoint utilises pagination, is it consistent with the appendices?
  • An introduction exists and clearly outlines the problem being solved. Ideally, the first paragraph should be understandable by a non-technical audience.
  • All outstanding threads are resolved
    • All feedback is incorporated into the proposal text itself, either as a fix or noted as an alternative
  • While the exact sections do not need to be present, the details implied by the proposal template are covered. Namely:
    • Introduction
    • Proposal text
    • Potential issues
    • Alternatives
    • Dependencies
  • Stable identifiers are used throughout the proposal, except for the unstable prefix section
    • Unstable prefixes consider the awkward accepted-but-not-merged state
    • Chosen unstable prefixes do not pollute any global namespace (use “org.matrix.mscXXXX”, not “org.matrix”).
  • Changes have applicable Sign Off from all authors/editors/contributors
  • There is a dedicated "Security Considerations" section which detail any possible attacks/vulnerabilities this proposal may introduce, even if this is "None.". See RFC3552 for things to think about, but in particular pay attention to the OWASP Top Ten.

@turt2live
Copy link
Copy Markdown
Member

@mscbot fcp merge

@mscbot
Copy link
Copy Markdown
Collaborator

mscbot commented Mar 23, 2026

Team member @turt2live has proposed to merge this. The next step is review by the rest of the tagged people:

Once at least 75% of reviewers approve (and there are no outstanding concerns), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for information about what commands tagged team members can give me.

@mscbot mscbot added proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. disposition-merge labels Mar 23, 2026
@turt2live turt2live moved this from Proposed for FCP readiness to Ready for FCP ticks in Spec Core Team Workflow Mar 23, 2026
Comment on lines +42 to +43
This change breaks backwards compatibility between servers relying on 30x-redirects and old clients
that do not implement this MSC.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this potentially problematic? If we merge this proposal, a server could only start using 30x-redirects if it controls all of its clients and can ensure that they've also implemented the new version of the spec. This seems feasible in a corporate setup but probably not in the public federation. It sounds a bit crazy but do we not need to version .well-known/matrix/client to prevent incompatibilities?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, but given that mozilla has already been rolling this out in production and all the clients I tested so far worked fine with it, I don't think this will be problematic in practice.

The new wording is "Clients should follow 30x redirects" (similar to the wording in the Server-Server-API), so a server admin would hopefully be aware that a few clients might have chosen to not support such a redirect, anyway.

It might still make sense to introduce a versioned well-known like .well-known/matrix/v2/client, e.g. with Matrix 2.0, but if that's desired I think there should be another MSC about this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] all the clients I tested so far worked fine with it, I don't think this will be problematic in practice.

Ah ok. If clients seem to already value redirects today, I guess this will be fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the thing this breaks is auto-discovery of the actual homeserver URL to use when given a full user ID (or a server name). So the damage is limited to user's using clients that don't automatically follow redirects and are trying to login in with a full user ID.

Given that I think this is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00-weekly-pings Tracking for weekly pings in the SCT office. 00 to make it first in the labels list. client-server Client-Server API disposition-merge kind:maintenance MSC which clarifies/updates existing spec proposal A matrix spec change proposal proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. s2s Server-to-Server API (federation)

Projects

Status: Ready for FCP ticks

Development

Successfully merging this pull request may close these issues.

Client/server discovery should support following 3xx redirects

8 participants