Skip to content

Conversation

DonPrus
Copy link

@DonPrus DonPrus commented Sep 15, 2025

Summary

This MSC proposes to generalize HTTPS permalinks by introducing a generic Matrix link resolver (drop-in replacement for matrix.to) and a standardized way for clients to discover a resolver base URL via /.well-known/matrix/client. This enables organizations to use branded resolver domains while keeping the existing matrix.to path/query grammar intact.

Motivation

  • Spec currently hardcodes matrix.to in the "matrix.to navigation" section, making custom resolvers non-standard.
  • The matrix: URI scheme is standard, but HTTPS permalinks are still required for email/web contexts.
  • Fragmentation already exists (Element permalinkPrefix, Synapse client_base_url) without a protocol-level knob.

What this MSC introduces

  • A resolver-agnostic concept for HTTPS permalinks (same grammar as matrix.to).
  • Discovery precedence: user setting → /.well-known/matrix/client → fallback to https://matrix.to.
  • Unstable key: org.matrix.msc4352.permalink_base_url → Stable key: m.permalink_base_url.

File

  • proposals/4352-customizable-permalink-base-url.md (this PR assigns the MSC number)

References

  • Spec process & how MSC IDs / filenames work; proposal template & checklist.
  • Spec: matrix: URI scheme and matrix.to navigation (Appendices/URIs).
  • Prior art in the ecosystem:
    • Element Web permalinkPrefix (docs/historical config.md)
    • Synapse client_base_url for emails (notification links defaulting to https://matrix.to)

Rendered Markdown

Rendered: proposals/4352-customizable-permalink-base-url.md

Author

Author: @DonPrus
idea : element-hq/element-meta#2399

@DonPrus DonPrus changed the title MSCXXXX: Customizable HTTPS permalink base URLs via server discovery MSC4352: Customizable HTTPS permalink base URLs via server discovery Sep 15, 2025
- Introduce generic Matrix link resolver for HTTPS permalinks
- Well-known discovery: org.matrix.msc4352.permalink_base_url → m.permalink_base_url
- Keep matrix.to path/query grammar; fallback to https://matrix.to

Signed-off-by: Igor Somov <donprusne@gmail.com>
@tulir tulir added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Sep 15, 2025
Copy link
Member

Choose a reason for hiding this comment

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

Implementation requirements:

  • Client

@DonPrus DonPrus force-pushed the msc-custom-link-resolver branch from 0f7e782 to cf56753 Compare September 15, 2025 11:29

## Problem

Matrix currently supports two major ways to reference resources: the `matrix:` URI scheme and HTTPS-based permalinks commonly using `matrix.to`. The specification explicitly documents the `matrix.to` form and even states that such URIs "must always start with `https://matrix.to/#/`" for the matrix.to navigation format. This tight coupling to a single domain prevents organizations and deployments from using their own branded resolver domains for invites and permalinks, despite valid branding, trust and policy needs. It also fragments behavior across clients which already implement ad-hoc overrides. [Spec references: Appendices/URIs and matrix.to navigation; `matrix:` scheme]
Copy link
Member

Choose a reason for hiding this comment

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

Please wrap lines to ~120 characters

Signed-off-by: Igor Somov <donprusne@gmail.com>
Comment on lines +73 to +78
### 4. Resolution behavior

This MSC does **not** require clients to perform network requests to the resolver domain. Like `matrix.to`, clients
SHOULD treat HTTPS permalinks primarily as **hints** for in-app navigation: parse the identifier and act locally if
possible (join, open DM, navigate to event). The resolver service is optional infrastructure for environments without a
Matrix-aware client.
Copy link
Member

Choose a reason for hiding this comment

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

This part sounds suspicious. Does the MSC suggest that custom permalink prefixes should be used in-app too instead of only outside the app? If so, how would a client on another homeserver detect that it's a matrix.to-equivalent link?

Element web used to have (or still has? not sure, I hope it was fixed) a bug/anti-feature where permalinkPrefix was applied in @mentions and such in messages too. The result was that mentions, room links and other permalinks were broken for everyone on other clients. I'd be strongly opposed to codifying such a broken feature in the spec.

Even if it's not intended to be used in-app, if a "share" button gives out such links, there's a risk users will send them in-app, leading to worse UX for everyone on other servers (because the app wouldn't be able to route the links internally). If the spec wants to standardize allowing custom links, it might also need to mandate some kind of automatic conversion to matrix: URIs when sending such links in-app. For example, when the user sends https://custom.permalink.to/#/#room:example.com, the client could linkify it before sending and produce <a href="matrix:r/room:example.com">https://custom.permalink.to/#/#room:example.com</a>, which would work in all clients

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the detailed feedback — I fully agree with the risks. MSC4352 does not intend to use a custom HTTPS
resolver for in‑app navigation. The goal is only to generate shareable links for outside‑Matrix contexts
(email/social/other messengers/etc.), while matrix: URIs remain the in‑app priority.

To remove ambiguity, here are normative clarifications I propose to add:

  1. In‑app usage (normative):
    Clients MUST NOT use a resolver-based HTTPS permalink for in‑app links (mentions, room/event links,
    or any navigation shown to Matrix users).
    Clients MUST prefer the matrix: URI scheme (or native navigation) for all in‑app UX.
  2. Sending links in Matrix (normative):
    If a user pastes a https:///#/[/][?...] link, the client SHOULD keep the visible text but
    MUST emit a link whose href is the equivalent matrix: URI in formatted_body, so it works in all clients.
    The plain‑text body may keep the original text; clickability is provided by formatted_body.
    No network calls to the resolver are needed, and no domain is imposed on other clients.
  3. Receiving (non‑breaking):
    Clients MUST support matrix: URIs.
    Clients MAY additionally recognise HTTPS permalinks that match the matrix.to navigation grammar regardless of
    hostname, but this is not required by MSC4352.
    This means MSC4352 does not require clients to parse arbitrary domains; matrix: URIs provide the compatibility path.
  4. Editorial tweak to “Generation algorithm”:
    State that the algorithm applies to share/copy for outside‑Matrix contexts, not in‑app navigation.
    Add an explicit preference for matrix: URIs for any in‑app scenarios.

If the MUST/SHOULD/MAY wording looks reasonable, I can update the MSC

Copy link

Choose a reason for hiding this comment

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

The goal is only to generate shareable links for outside‑Matrix contexts
(email/social/other messengers/etc.), while matrix: URIs remain the in‑app priority.

What are the requirements for a web service? Should it be something like the matrix.to server hosted alongside a homeserver?

Why another URI scheme (which will inevitably suffer from linkrot when homeservers disappear again)? The Matrix URI is both a registered URI scheme with the iana and is a safelisted schema for HTML5, so it can be used outside of Matrix clients already. Wouldn't it preferable to improve client support for the matrix URI scheme to not have the centralization around resolver servers while still having the trust of "this is an official URI scheme my client understands"?

…p to ~120 chars

Signed-off-by: Igor Somov <donprusne@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants