Choosing a Matrix server name and domain layout

Pick a permanent Matrix server_name, lay out subdomains for Synapse, MAS and Element Web, and use delegation so user IDs stay short while services can move.

On this page

Why the Matrix server name is the one decision you cannot easily undo

Before you install a Matrix homeserver, you must choose its server_name, because that value is fixed into every user ID (for example, @alice:example.com) and every room ID. The hostnames that carry traffic, such as the one serving Synapse or the one serving Element Web, can change later. Treat the server name as a permanent identity for your organization and treat the hostnames as replaceable addresses. Teams that skip this distinction often bind the identity to a host like matrix.example.com and then find that every user ID carries that host name forever.

According to the Synapse documentation, the server_name setting determines how users and rooms are identified across the federation. Delegation lets a domain such as example.com serve identities while the homeserver actually runs on another host, reached on port 443 through the /.well-known/matrix/server file. Without delegation, Synapse federates on port 8448 by default, so you must either open that port to other servers or publish a delegation record that points elsewhere. Confirm which of these you will use before you request certificates or DNS records, because changing the answer later means changing where other servers look for you.

Plan the layout before installation, not after the first users arrive. Decide who owns the apex domain, whether Synapse, Matrix Authentication Service and Element Web each get their own hostname, and whether any of them will sit on infrastructure you may replace. Check that your DNS and certificate process can issue names for each host, and confirm with your security team which hostnames must stay internal. A reasonable test is whether you could move Synapse to a new server without any user ID changing. If the answer is no, the layout needs rework before you start.

How server_name, delegation and service hostnames fit together

The walk starts with a client that knows only example.com, the permanent server_name. It fetches /.well-known/matrix/client on that domain, which points the client at the Synapse host, and the homeserver answers on matrix.example.com. Browsers load Element Web and sign-in is handed to the MAS host, while a remote server reaches the federation listener through its own discovery path. Check that every hostname resolves and that the user ID domain never changes when a service moves.

Fixed server_name identity on the left, movable service hostnames on the right.

Which subdomain layout fits your organization

This layout sets server_name to your bare organization domain, such as example.com, and serves the Matrix services from subdomains like matrix.example.com and chat.example.com. It suits organizations that want the shortest possible user IDs and that already control their apex domain's DNS and web presence. Discovery does the work here: the apex serves /.well-known/matrix/server and /.well-known/matrix/client, so users keep @name:example.com while Synapse runs on a subdomain.

  • User IDs: Accounts look like @alice:example.com, the same as the email domain most staff already use.
  • What moves easily: Synapse, MAS and Element Web can move to new hosts as long as the discovery files point to the new targets.
  • What is hard to change: The server_name itself is permanent once users and rooms exist, and the apex must keep serving the discovery files.
  • Certificates: Confirm that the certificate covers the apex host that serves discovery and each subdomain that serves traffic.
  • Public_baseurl: Set it to the client-facing URL of the Synapse host, which is not the apex.

Before committing, confirm with your web team who controls the apex and whether it can serve the two .well-known files with the required CORS headers.",

Server name and hostname options compared

This table compares the main choices for server_name, delegation, public_baseurl, and the MAS and Element Web hostnames, along with federation port exposure. Read each row as a decision: the option, when it fits, what it does to user IDs and later moves, and what to confirm with your team before deploying.

DecisionOption and when it fitsTrade-off for user IDs and future movesWhat to confirm with the team
server_nameBare organization domain, such as example.com, when the domain is owned long term and only used for Matrix identityFixed permanently: user IDs and room IDs embed it, so changing it later means a new identity spaceWho owns the domain, whether it hosts other mail or web services, and that nobody plans to rename the organization
server_nameSubdomain such as chat.example.com, when the domain is shared with other services or may change ownershipUser IDs become longer (for example @name:chat.example.com), and the value is still permanent once users existWhether users will accept the longer ID and whether the name matches the brand used in internal communications
Delegation targetSynapse or MAS on a dedicated host such as matrix.example.com, with /.well-known/matrix/server on the bare domainUsers keep short IDs while the backend host can move, but the well-known file must stay accurate after every moveWho controls the bare domain web server, and that it can serve a JSON file over HTTPS
Delegation targetSynapse served directly on the server_name host, with no delegationSimplest setup and no well-known file to maintain, but the host name is tied to the identity foreverWhether the public host and server_name can share a certificate and DNS record without conflicts
Synapse public_baseurlClient-facing HTTPS URL that matches the host users reach through the reverse proxyMust match what clients and federation peers see, so a later host change also needs this key updatedThe exact URL after the proxy, and whether any load balancer rewrites the host header
MAS hostnameSeparate host such as auth.example.com, when identity sign-in should be its own serviceAdds a second certificate and proxy route, and the MAS issuer URL becomes part of login flows that are hard to change laterWhether the auth host will be shared with other OIDC applications and who manages its DNS and TLS
Element Web hostnameSeparate host such as app.example.com or chat.example.com, serving the web client as static filesIndependent from the homeserver, so the client can move or be replaced, but needs its own CORS and discovery setupWhether the web client is hosted by your team or a vendor image, and which origins the client is allowed to call
Federation port exposurePort 8448 open to the internet for federation, when federation is intendedFederation reaches the server directly unless delegation points it at port 443, so firewall rules must match the chosen designWhether federation is enabled at all, and whether an allowlist or an isolated network applies instead
Federation port exposureFederation on port 443 through delegation, when the proxy can route the federation pathsFewer open ports, but the reverse proxy must forward federation requests correctlyWhether the team can confirm the well-known files and proxy routes before go-live

Mistakes that are costly to reverse after users join

Most of these errors look harmless on day one because no users exist yet. Once accounts, rooms and client configurations are in place, each one turns into a migration project. The cards below cover the decisions to settle before the first user registers.

Naming the server after today's company

The server_name is the permanent suffix of every user ID and room ID, so a hostname tied to a brand, product or legal entity carries that name into every account. If the company renames, merges or sells a business unit, the identifiers do not follow. Choose a durable domain you control, and ask whether the name still reads correctly if the organization changes. Confirm with leadership who owns that domain and its renewal before you commit.

Putting Synapse on the apex

Running Synapse directly on the bare domain, such as example.com, leaves no room for the website, the authentication service or Element Web to sit on their own hostnames. Later moves then require changing the public site or the apex records. Give Synapse a dedicated hostname such as matrix.example.com and publish discovery records from the apex, so the homeserver can move without touching the user-facing identity.

Mismatching public_baseurl and the client URL

Synapse uses public_baseurl to build URLs it hands back to clients, and the value should match the address users actually reach. A mismatch between the configured base URL and the address in the client discovery file or reverse proxy produces login and media errors that are hard to trace. Set public_baseurl to the final client-facing URL before the first login, then test discovery from a browser and a client app.

Synapse installation docs

Changing server_name after accounts exist

The server_name fixes how users and rooms are identified, so changing it does not rename existing accounts. Users keep identifiers tied to the old name, and rooms created under it stay on that identity. Treat server_name as a one-time decision. Before go-live, confirm with the team that the name is final, and record it in the deployment runbook alongside the domain's DNS and certificate owners.

Treating SRV records as the easy path

SRV records for federation look simpler on paper, but the Synapse federation guidance points to well-known delegation as the more practical route, and SRV records are discouraged for this purpose. Teams that pick SRV often find they must maintain records in a DNS zone they do not fully control, and debugging them is harder than checking a static JSON file. Plan the /.well-known/matrix/server and /.well-known/matrix/client files from the start, and confirm with your DNS team who can publish them.

Setting up the domain layout before installation

This sequence fixes the permanent server_name, reserves the hostnames, and publishes discovery files so that user IDs stay short while Synapse, MAS and Element Web can be moved later without changing anyone's Matrix identity.

  1. Confirm the permanent server name

    Leadership and legal or brand owners agree on the domain that will appear after the colon in every user ID, such as @name:example.com. Your team records who approved it and confirms the domain is controlled by the organization for the long term. Synapse fixes server_name as the identity of the deployment, so treat this decision as permanent. Done when the approved value is written in the design record and nobody on the project proposes a different one.

  2. Reserve DNS records for the chosen hostnames

    The infrastructure or DNS team creates records for the hostnames that will serve the homeserver, the authentication service and Element Web, such as matrix.example.com for Synapse and chat.example.com for the web client. Keep the bare server_name separate, since it only needs to serve the discovery files and does not have to host Synapse itself. Confirm with the DNS owner who can change these records and how long changes take in your DNS provider. Done when each hostname resolves to the address or load balancer planned for it.

  3. Decide where each service runs

    The platform and security leads decide which host or cluster runs Synapse, whether Matrix Authentication Service gets its own hostname, and where Element Web is served. Record each choice with its hostname and TLS certificate owner. Changing the hostname of a client-facing service later is usually simpler than changing server_name, so keep the server name stable and place the services behind hostnames you expect to move. Done when a table lists every service, hostname and certificate owner.

  4. Publish the server discovery file on server_name

    The web or platform team serves a file at /.well-known/matrix/server over HTTPS on the bare server_name domain. The file points federation traffic to the hostname that runs Synapse, usually on port 443, so remote servers can reach the homeserver without a direct connection to the bare domain. Confirm the exact JSON format in the Synapse federation documentation before writing it. Done when an HTTPS request to that path on the bare domain returns the expected JSON with the Synapse hostname.

  5. Publish the client discovery file with CORS headers

    The same team serves /.well-known/matrix/client on the bare server_name over HTTPS. The file names the client-facing base URL for the homeserver, which Element Web reads to find Synapse. Browsers need CORS headers on this path, so confirm the required headers in the Synapse installation documentation and the delegation guide before deployment. Done when a browser-origin request to the path returns the JSON and the expected Access-Control-Allow-Origin header.

  6. Set public_baseurl to the client-facing URL

    The Synapse administrator sets public_baseurl in homeserver.yaml to the exact HTTPS address users and clients reach, which must match the base_url published in the client discovery file. A mismatch causes links, emails and some redirects to point to the wrong place. Record the value alongside server_name in the configuration review. Done when the configuration value, the discovery file and the reverse proxy hostname all match character for character.

  7. Verify discovery from an outside client

    A team member not involved in the configuration, or an external checker from a network outside your corporate LAN, requests both discovery files, resolves the hostnames and opens Element Web against the server name. The check confirms that a user can sign in with @name:server_name while the homeserver runs on the subdomain. Record the requests, responses and any failures in the change ticket. Done when the outside check succeeds and the results are attached to the design record.

How services can move later without renaming users

Moving where Synapse runs is a DNS and delegation change, while changing server_name is a rename of every user and room identity. The server_name is the part after the colon in @user:example.com, and it is fixed when the homeserver is first configured. Changing the host that serves Synapse, for example moving it from matrix.example.com to a new cluster, does not touch server_name, so existing accounts and room memberships keep their identifiers. Before you commit, confirm with your team that the server_name you choose is one your organization will still own in five or more years, because retiring it later means migrating accounts rather than repointing a record.

The well-known files are what make a move invisible to users. The client file served at /.well-known/matrix/client tells Element Web and other clients which base_url to use, and the server file tells federating servers where to reach the homeserver for your server_name. When Synapse moves, you update the m.homeserver base_url and the delegation target in these files, then point DNS at the new host. Keep public_baseurl in the Synapse configuration aligned with the new client-facing URL, since the installation guidance ties client discovery to it. Serving these files from the domain that owns server_name, and not only from the Synapse host, is the decision that keeps the move contained.

After any move, retest the paths that depend on the old host: client login and discovery from a fresh browser profile, federation with at least one external server and a room you already share, media upload and download, and the reverse proxy routes that forward to Synapse. If you also move MAS or Element Web, repeat the check for each service, because the redirect and callback URLs registered with your identity provider may point at the old hostname. Ask your DNS and proxy administrators to record the old and new TTL values in advance so the cutover window and any caching surprises are known before users are affected.

Questions teams ask before choosing a Matrix domain

Can we change our Matrix server_name later?

In practice, no. The server_name is written into every user ID (@user:example.com) and room ID, so changing it later means existing accounts and room histories no longer match the new name and are not carried over cleanly. You can move where the services run later, such as moving Synapse from matrix.example.com to another host, because delegation through /.well-known/matrix/server and /.well-known/matrix/client keeps the name stable. Treat the server_name as permanent and choose the domain your organization will still control in five years. Confirm the exact migration options with the Synapse documentation before you rely on any of them.

Can our own team choose and set up the domain layout?

Yes, the layout decision is mostly a planning and DNS exercise that an internal team can do. The work includes picking the server_name, deciding where Synapse, Matrix Authentication Service and Element Web will run, creating DNS records, issuing TLS certificates and publishing the discovery files that the Synapse installation docs describe. Teams that already run reverse proxies and manage DNS for other services usually find this manageable. The harder part is agreeing on the naming with security, legal and brand owners before anything goes live, because that agreement is what is difficult to reverse.

What does outside help cover, and what drives its effort?

An implementation partner typically covers the naming workshop, the DNS and subdomain plan, certificate and proxy setup, discovery testing from clients and a written record of the decisions. Effort rises with the number of services that need their own hostname, whether you run a single server or several, whether an identity provider must be wired in at the same time, and how many DNS zones and certificate authorities your organization already uses. Effort falls when DNS ownership is clear and the naming decision is already approved. Ask any provider for a written scope listing hostnames, environments and test steps, because that scope is what the quote should follow.

What do we need to provide before the work starts?

You need four things ready: control of the DNS zone that will hold the server_name, a decision on the permanent server_name, a plan for TLS certificates for each public hostname, and a named owner who can approve naming and public exposure. Also prepare a list of infrastructure you control, such as cloud accounts, load balancers and the proxy platform, plus access to the environments where the services will run. Missing DNS delegation or unclear ownership of the zone is the most common cause of delays, so confirm it first.

Should federation be on from the start?

Decide this before publishing the server_name, because it determines which hostnames and ports must be reachable from outside. Synapse federates on port 8448 by default, and the federation_domain_whitelist setting can restrict federation to listed domains, while an empty list disables it. Many organizations start with federation limited to a short list of trusted servers, or off entirely, then open it later once monitoring, moderation and firewall rules are proven. The Synapse docs recommend firewalling the federation listener in either case. Your security and data protection teams should sign off on this choice, since it decides who can exchange messages with your users.

Does the domain choice change how an air-gapped or ESS deployment works?

Yes. In an air-gapped network, federation is usually off or limited to internal servers, so the public DNS and certificate steps shrink but the internal name resolution, certificate trust and client discovery still need planning. A name chosen for the internet can still be used internally if the internal DNS resolves it correctly, but confirm that clients inside the network can reach the discovery endpoints. For Element Server Suite, the Helm chart configuration and ingress hostnames must match the server_name and the subdomains you plan, so settle the layout before installing. Ask the ESS documentation and your installer which hostnames the chart expects and whether any of them can be changed after installation.

Does a short user ID matter enough to plan around?

It matters because users see their Matrix ID in every conversation, invitation and login. A short domain such as example.com keeps the ID readable, while a long hostname such as matrix.internal.example.com makes it harder to recognize and share. The trade-off is that the bare domain often hosts other services, so you may need delegation to point the Matrix services at a dedicated hostname. Use the bare domain for the server_name only if the discovery files can live there without conflicts, and verify that the web team agrees before publishing anything.

Security and operational considerations for the domain plan

The domain layout decides which hostnames carry federation, admin traffic, client discovery and browser access, so each choice creates a security or operational duty. The cards below cover the controls that keep those hostnames safe and stable once users and remote servers depend on them.

Keep federation and admin paths private

The federation listener on port 8448 and the /_synapse/admin API should not be reachable from the open internet unless you have decided they must be. Synapse's documentation recommends firewalling the federation listener when federation is restricted. Confirm which paths your reverse proxy exposes, and test from outside your network that admin endpoints return no content. This check belongs in every change to the proxy configuration.

Synapse configuration manual

Certificate coverage for every hostname

Each name that serves Matrix traffic needs a valid certificate: the server name host, the Synapse host, MAS and Element Web if they are separate. A missing name on any of them breaks client discovery or federation in ways that look like outages to users. Record which certificate covers which hostname, set renewal alerts, and confirm that federation clients accept the chain from outside your network.

CORS headers for browser discovery

Browser-based clients fetch /.well-known/matrix/client from a cross-origin page, so the discovery response must include the CORS headers browsers expect. Without them, Element Web and other web clients may fail to find the homeserver even when server-to-server federation works. Test the discovery URL from a browser on a different origin after every proxy or CDN change.

Federation whitelist and the domain

The domain you choose becomes the trust boundary for federation. Synapse's federation_domain_whitelist setting limits federation to listed domains, and an empty list disables federation entirely. Decide before launch whether the server federates openly, only with named partners, or not at all, because that decision depends on the server name and any later change requires coordinating with the remote servers you have already reached.

Synapse federation docs

DNS change control

Records for the server name, delegation and client discovery should live under a documented change process with an owner, a review step and a rollback record. A wrong delegation record can send federation traffic to the wrong host and is slow to undo because remote servers and caches keep older answers. Keep a record of each hostname, its purpose and the service behind it, and treat any edit to these records as a production change.

Monitoring the discovery files

The files served at /.well-known/matrix/server and /.well-known/matrix/client are small but critical, and they can change silently when a web server or CDN is updated. Schedule an automated check that fetches both files, validates the JSON and confirms the expected base_url values. Alert on any failure, and keep a copy of the expected content in version control so that drift is easy to spot.

What DeployOpen needs from your team to settle the layout

Before DeployOpen can fix the server name, we need four decisions from your team, and the first is the permanent server_name. This value becomes the domain part of every user ID and room ID, and Synapse uses it to identify users and rooms for as long as the homeserver exists. Your team should decide whether the bare company domain (for example, the part after the @ in a user ID) is the right public identity, or whether a dedicated domain used only for chat is better. Confirm who owns that decision, since it is hard to reverse once users exist and the answer affects every later subdomain choice.

Second, we need access to DNS and certificate management for the chosen domain. Delegation for the server and client discovery files depends on a host that answers on port 443, a working TLS certificate, and the ability to publish records for the Synapse federation listener on port 8448 if federation stays enabled. Ask your DNS and certificate owners to confirm who can create the records, who renews certificates, and whether a wildcard certificate is permitted. Hosting location matters here too: name the cloud account, data center or private network where Synapse, MAS and Element Web will run, because that decides which subdomains are reachable from users and from other servers.

Third, we need your identity provider plans. Synapse can use OpenID Connect, SAML2 or CAS, and Matrix Authentication Service connects to upstream OpenID Connect providers, so the choice of provider determines which hostname MAS needs and whether a bridge is required for SAML or LDAP. Confirm which provider your staff already use and whether it will hold the login pages on its own domain. Fourth, document your federation policy in writing: fully open, limited to a list of domains through federation_domain_whitelist, or disabled. That policy shapes whether port 8448 must be public at all. We recommend confirming these four inputs together, because a change to the server name after launch affects every identity, certificate and client setting that depends on it.

How DeployOpen scopes and delivers the Matrix domain layout

DeployOpen plans and implements self-hosted open-source platforms inside the client's own infrastructure, including the Matrix domain layout described on this page. The work starts with a written scope that fixes the server name, the service hostnames and the discovery design before any configuration is applied.

How we scope

  • Written scope covers the permanent server_name, the hostnames for Synapse, MAS and Element Web, and the discovery endpoints.
  • Scope records which federation and identity decisions depend on the chosen server name before work starts.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing; ongoing support is available as a retainer.

How we build

  • Configure server_name, public_baseurl and delegation so user IDs stay short while services sit on separate hostnames.
  • Test client discovery from Element Web and federation reachability on port 8448 or delegated ports before go-live.
  • Check DNS, TLS certificates and reverse proxy routes for each hostname in the agreed layout.

How we hand over

  • Documented domain map listing each hostname, its service, its certificate owner and its discovery records.
  • Runbook for moving MAS or Element Web to a new host without changing the server name.
  • Written record of the federation domain policy and the settings that depend on the server name.

How we support

  • Retainer support can cover DNS and certificate changes, delegation checks and review of new hostnames.
  • Retesting after upgrades or infrastructure moves confirms discovery and federation still resolve correctly.
  • Support reviews are scoped in writing, so the client knows what is covered and what needs a new engagement.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.