Mattermost pre-authentication secrets at the reverse proxy

A pre-authentication secret header lets your reverse proxy reject unauthenticated mobile and desktop requests before they reach Mattermost. This page covers the decisions, exemptions and checks needed to roll it out safely.

On this page

What a Mattermost pre-authentication secret blocks at the reverse proxy

The X-Mattermost-Preauth-Secret header lets your reverse proxy turn away unauthenticated client traffic before that traffic reaches the Mattermost application. Teams reach for it when a self-hosted Mattermost server is reachable from the internet or a wide network, and when mobile and desktop clients must reach it too. The proxy checks for a shared secret the official clients send, so requests that lack it never get far enough to touch the login flow, the API or the server's error handling. Each control you add in front of the application is one less pre-login path an attacker can probe.

The control matters most in three situations: a server exposed beyond the corporate network, a large mobile fleet whose devices sit on networks you do not manage, and a security team that wants to shrink the pre-login attack surface without waiting for application changes. It adds little when the server is reachable only over a VPN or private network with strong device controls, because the same traffic is already filtered upstream. It also does not replace SSO, MFA or session controls, which still decide who is signed in. Plan it as one layer among several.

Before you write any proxy rule, confirm the exact behavior in the Mattermost documentation for the release you run. You need to know which client versions send the header, which endpoints it must exempt for SSO callbacks and identity provider redirects, what the server or proxy returns on rejection, and whether the 403 response carries a header you can match. Check these details against the release notes for your version and test them on a staging server, since monthly releases and Extended Support Releases can change client behavior.

A request with the preauth header is checked at the proxy before Mattermost sees it

The flow starts with a mobile or desktop client sending a request to the reverse proxy. The proxy checks the X-Mattermost-Preauth-Secret header, and this check is the trust boundary. A request with a missing or wrong header gets a 403 at the proxy, so the Mattermost application server never receives it. Requests on the SSO exemption paths pass through to the SSO identity provider and return to the client, because browser sign-in redirects cannot carry the header. Confirm the exact header name and exempt paths against the Mattermost documentation before you write proxy rules.

Conceptual flow; confirm header names and exempt paths against the docs.

Which Mattermost server and client versions support the preauth secret

The preauth secret only works when both the server and the client builds support it, so version alignment is the first step and should be settled before any proxy rule is written. A proxy that requires the X-Mattermost-Preauth-Secret header will reject traffic from any mobile or desktop build that does not send it, so an unsupported client becomes a locked-out user rather than a protected one. Confirm the minimum server release that includes the feature and the minimum iOS, Android and desktop builds that send the header, using the Mattermost server releases page and the client release notes for each platform. Do not assume a feature is present in your release line because it appears in a newer changelog.

Mattermost ships server binaries on the 16th of each month, so the feature will arrive in some monthly releases and not others. Teams on a monthly release need to check whether their current build is supported and when it leaves support. For example, v11.11 was released on 2026-09-16 with support ending 2026-12-15, so a team on that line would have to move to a later release before that date regardless of this feature. Teams on an Extended Support Release, such as v11.7 with support ending 2027-05-15, should confirm whether the feature is backported to that line, since ESRs receive a narrower set of changes.

Plan any required server and client upgrades before enabling enforcement, and run the rejection in report-only or staged form first. Build an inventory of installed app versions, including older desktop clients that users may not update, and confirm the upgrade windows for each release line. Enforcement should follow the point at which every supported client sends the header, or the proxy should exempt the older builds for a defined period. Record the decision, the versions tested and the rollback steps so the change can be reviewed later.

Configuration options for enforcing the preauth secret

This table compares four ways to apply a pre-authentication secret check at the reverse proxy and one rollout method, with what each protects, what it can break, who must change, and when it fits. Read each row as a trade-off: broader enforcement protects more surface but raises the risk of breaking sign-in or older clients. Confirm header names, values and default behavior in the Mattermost docs and your proxy vendor's documentation before you write any rule.

OptionWhat it protects and what it can breakWho must changeWhen it fits
Enforce on all pathsProtects every route to the Mattermost server from callers without the secret. Can break browser sign-in, SSO callbacks, static assets and webhooks that the proxy never sees from a mobile or desktop client.Proxy team writes the rule; Mattermost admins test every login method; integration owners confirm webhook paths.Fits only after SSO and integration paths are mapped and tested in a staging copy of the proxy.
Limit enforcement to mobile and desktop API pathsTargets the API routes that native clients call, leaving browser-facing pages reachable. Can miss API calls that browsers or integrations make, and can leave a gap if the path match is too narrow.Proxy team defines the path match; client rollout owners confirm which app versions send the header.Fits when browser and SSO traffic must stay unchanged and the native client population is known.
Exempt SSO callback and login pathsKeeps identity provider redirects and login endpoints working while the rest of the API stays gated. Can leave the login surface unprotected by this control, so other login hardening must cover it.Mattermost admins list the SSO endpoints from the SAML or OAuth configuration; proxy team adds the exemptions and documents them.Fits most organizations using SSO, since login flows cannot send a header the identity provider controls.
Report-only or logging mode before blockingRecords which requests would be rejected without rejecting them, so teams find missing clients and exempt paths. Does not protect anything while in this mode, and logs can be noisy or incomplete.Proxy team enables logging and reviews results; client rollout owners track which devices still lack the header; security owner sets the cutover date.Fits every rollout, and is the safer first step when the client fleet is large or only partly managed.

Which SSO endpoints to exempt so sign-in still works

Sign-in is a chain of requests that start in the browser or client, pass through the identity provider, and return to Mattermost. A proxy rule that demands the pre-authentication secret on every path will break some of those hops, so each exemption needs a reason and a test. The exact list depends on the SSO method in use and must come from the current docs for that method.

SAML assertion consumer path

The identity provider posts the SAML response back to Mattermost's assertion consumer endpoint through the user's browser, and that browser request carries no Mattermost pre-authentication header. If the proxy rejects it, the user lands on an error after a successful login at the identity provider. Verify the exact path in the SAML single sign-on docs for your version, then complete a full login from a fresh browser session and confirm the user reaches the channel list.

SAML SSO docs

SAML metadata path

Identity providers and administrators fetch Mattermost's SAML service provider metadata from a fixed path so the identity provider can register the service. That fetch is made by a machine, not by a client that holds the secret. Confirm that the metadata URL returns the expected XML through the proxy, and that your identity provider still validates the signing certificate after the change.

OAuth or OIDC callback path

For OAuth or OIDC sign-in, the identity provider redirects the browser back to a callback URL on Mattermost with an authorization code. The redirect arrives without the secret, so the callback path must be exempt. Check that the registered redirect URI in the identity provider matches the proxy hostname exactly, including scheme and port, or the callback fails before Mattermost sees it.

Login page and token exchange

Web and desktop clients load the login page and then call Mattermost to exchange credentials or a code for a session token. Those calls happen before the client holds a session, so a rule that blocks them stops sign-in entirely. Keep the exemption narrow to the login and token routes, and verify that a request without the secret reaches the login page while a request to a protected API route still returns 403.

Session-free asset requests

Sign-in pages request static assets such as scripts, styles and images before any session exists. If these are blocked, the login screen renders incompletely and users see a blank or broken page that looks like an SSO fault. Test the login page in a private browser window with the secret header absent, and check the browser console for blocked asset requests.

Routes that must stay protected

Every exemption widens the unauthenticated surface, so keep the list as short as the SSO method allows. API routes, file endpoints, websocket connections and plugin paths should not be exempt unless the vendor docs require it for sign-in. Review the proxy configuration after each upgrade, because new endpoints can appear in a release, and test that each protected route still returns the 403 rejection header without the secret.

Setting up the preauth secret at the proxy, step by step

This sequence moves the preauth secret from inventory to blocking enforcement. A logging stage and tests on each client platform and SSO method keep working users from being cut off without warning.

  1. Inventory every client build and version

    The team that owns endpoints and mobile devices, with the Mattermost administrator, lists every iOS, Android and desktop build in use, its version, and its owner. Include browser access and any custom builds, since those are the entries most often missed. Record which builds send the header today and which need an update. Mark any build that cannot be updated, because it determines whether blocking is possible for its users. The step is done when every active build appears on the list with an owner and a version. Ask your mobile device management provider to confirm version data for managed devices.

  2. Confirm header support in the documentation

    The platform engineer checks the Mattermost documentation for the server version you run and for each client version in the inventory. Confirm which server and client releases send the preauth header and what minimum client version applies to each platform. Use the server releases page to match your server version against current release and support dates. Record the answers in the change ticket along with the documentation version you read. The step is done when every client build is marked as supported, unsupported or pending a vendor answer. Do not assume support from a version number alone.

  3. Generate and store the secret

    The security engineering team generates a long, random value with a cryptographically secure generator and stores it in the organization's secrets manager. Use a separate value for each environment, such as production and staging, and limit read access to the proxy service accounts and the deployment pipeline. Keep the value out of Git repositories, chat channels and ticket comments. Ask each client vendor to confirm how their build receives and sends the value, and document a rotation procedure before go-live. The step is done when a retrieval test from the proxy host succeeds and an access review confirms who can read the secret.

  4. Configure the proxy to check the header

    The platform or network engineer adds a rule to the reverse proxy that compares the incoming X-Mattermost-Preauth-Secret header against the stored value on the agreed paths. Build the rule with rejection disabled so it can be observed first. Requests that fail the check are designed to receive a 403 response from the proxy and never reach Mattermost once blocking is on. Keep the rule in version-controlled configuration and load the value from the secrets manager at deploy time, not from a file baked into an image. The step is done when test requests with and without the header both appear in the proxy logs with the expected outcome.

  5. Exempt the SSO flows

    The identity team lists every Mattermost endpoint a browser touches during SSO sign-in, including login initiation, the callback and any metadata paths. Confirm each one against the SAML single sign-on documentation for your configured identity provider, and ask the provider vendor to confirm any redirect or callback URL it uses. Add only those paths to the exemption list, so the rest of the API stays protected. The step is done when a browser sign-in through each configured SSO method completes in testing and a request to an unlisted path is still checked by the rule.

  6. Run enforcement in logging mode

    The security operations team enables the rule in logging mode, so each request without a valid header is recorded but not rejected, and compares those entries with the inventory. Every unexplained entry points to a client, script, integration or proxy path that was missed. Resolve each one by updating the inventory, the exemption list or the client build before moving on. Keep the observation period open until the logs show that all known client platforms send the header and the unexplained entries have stopped. The step is done when the team can name the source of every failed request in that window and has recorded the evidence in the change ticket.

  7. Test each client platform and SSO method

    The QA team, with the mobile and desktop owners, runs test cases on every build in the inventory. Include a signed-in session that was open before the change, and confirm it keeps working while new sign-ins succeed, notifications arrive and file downloads load. Send a request without the header from each platform's test account to confirm the proxy rejects it. Test custom builds and bot or integration traffic separately, because they may not behave like the standard apps. The step is done when every test case has a recorded result and each failure has an owner and a fix.

  8. Switch the rule to blocking

    The platform engineer changes the proxy rule from logging to rejection during an approved change window, using the same configuration that passed testing. Confirm that requests without a valid header receive a 403 response, and that signed-in mobile and desktop sessions and SSO flows still work. Keep the previous configuration ready so the rule can be reverted quickly if a client group fails. Watch the proxy and Mattermost logs after the switch for failed requests from known clients. The step is done when the post-change checks pass, the rollback steps are written in the ticket, and the owner signs off that blocking is in effect.

Security risks in the preauth secret design

A pre-authentication secret is a gate in front of Mattermost, not a login control, so its risks sit around the secret itself: where it is stored, how it changes, what logs record and whether traffic can route around the proxy. Each card names one failure mode and the control that addresses it.

Secret extracted from client builds

Any value compiled into an iOS, Android or desktop app can be recovered by someone who downloads and inspects the build. Treat the secret as visible to anyone holding the app, and never as a credential that proves a user's identity. Keep build pipelines from logging or embedding the value in public artifacts, and confirm which builds carry the header before rollout.

SAML SSO docs

No clean rotation path for installed clients

Installed apps keep the value they shipped with until users update them, so changing the secret on the proxy can lock out older clients. Plan rotation as a dual-accept window where the proxy accepts old and new values, then remove the old value once app versions have moved. Ask your mobile team how long they expect old builds to stay in use.

Secret written to proxy or application logs

Request logs at the reverse proxy and headers captured by Mattermost can record the secret on every request. Anyone with log access then holds a valid gate key. Configure the proxy to redact or omit this header from access logs, confirm the application server does not echo it into its own logs, and restrict who can read both.

Proxy strips or ignores the header

If the proxy drops the X-Mattermost-Preauth-Secret header on some routes, or a path rule skips the check, unauthenticated traffic reaches Mattermost without the gate. Test each exposed mobile and desktop route with and without the header, and confirm that a missing or wrong value returns the 403 rejection. Recheck after every proxy configuration change.

Bypass through the internal address

If the application server listens on a reachable internal address, a client can skip the proxy entirely and send requests without the header. Restrict the application server so it accepts connections only from the proxy, using firewall rules or a private network segment. Verify the restriction by attempting a direct request from outside the proxy's network.

Limits to confirm before you rely on the preauth secret

Before you rely on the X-Mattermost-Preauth-Secret header as a control, confirm its boundaries for each client type you run. The first question is whether the feature applies to every client you operate, including web browsers, the iOS and Android apps and the desktop app, and whether the version of each client in your environment sends the header at all. Web browser traffic deserves its own test, because a browser session that reaches Mattermost through a path your proxy does not inspect may bypass the check entirely. Record the client versions you tested, since support can differ between releases, and treat any client you cannot verify as unprotected.

Next, check how the header behaves across your edge. Load balancers, CDNs and WAFs can strip, rewrite or cache custom headers, and some terminate TLS before the request reaches your reverse proxy, so the header you set in one layer may not be the header Mattermost receives. Confirm that the header survives each hop, that it is not logged in plain text by components you do not control, and that the proxy rule matches the exact paths your SSO flows use. Mattermost's own SAML single sign-on documentation is the reference for identity provider callbacks, which is where exemptions most often go wrong.

Finally, plan for clients that cannot be updated and for version drift. Older apps that do not send the header will be rejected, so decide in advance whether you accept that disruption, run a short exception window, or keep those users on a separate path. Upgrades between monthly releases and Extended Support Releases can change how preauth checks are enforced or which endpoints the apps call, so repeat the test matrix after every server and client upgrade. Confirm the exact behavior for your versions with Mattermost's release notes and your own test environment before production rollout, because DeployOpen does not set these facts.

Common questions about the Mattermost preauth secret

How much effort does a pre-authentication secret rollout take?

The effort depends on how many moving parts must change together, not on the header itself. The main drivers are the number of client builds that must send the header (web, desktop and each mobile build), the number of reverse proxies or load balancers in front of Mattermost, the SSO method in use, and the change windows your organization allows. Each client build needs a release cycle, and users on old builds need a plan for the period before they upgrade. Ask any partner to break the estimate down by these items so you can see which ones are fixed and which depend on your own release calendar.

Can our internal team set up the preauth secret without outside help?

Often yes, if your team already owns the reverse proxy, runs Mattermost upgrades and controls the mobile and desktop build pipeline. The harder parts are rarely the proxy rule itself. They are testing SSO flows that must stay open, coordinating a rollout to apps that cannot be recalled, and checking that the rejection behavior holds for every client version you still support. A partner is most useful when those coordination and verification tasks would otherwise compete with your team's normal work. Be honest about whether anyone can own the rollout end to end.

What access does a pre-authentication secret project require from us?

Expect to provide access in four areas. First, administrative access to the reverse proxy or load balancer configuration, including a way to test and roll back changes. Second, a test Mattermost environment that mirrors production closely enough to exercise mobile, desktop and web sign-in. Third, access to the client build pipeline so the header can be added to each app build. Fourth, administrator access to your identity provider so SSO endpoints can be identified and exempted correctly. Confirm how each of these will be granted, logged and removed at the end of the engagement.

Does the preauth secret replace SSO or multi-factor authentication?

No. The X-Mattermost-Preauth-Secret header only blocks unauthenticated traffic from reaching Mattermost before it is processed. It does not identify users, does not check passwords and does not enforce a second factor. Users still sign in through your configured authentication method, whether that is email and password, SAML, OIDC or another supported provider, and MFA must still be enforced in the identity provider or in Mattermost settings. Treat the header as one layer that reduces exposure of the server, not as an access control for people.

How does rotating the preauth secret affect installed apps?

Any rotation changes the value the proxy expects, so every client that sends the old value will be rejected with a 403 until it receives the new one. Installed mobile and desktop apps hold the value inside their builds, which means a rotation is only safe if you can ship a new build to every user and keep the old value accepted during the transition. Plan the overlap window, the build release dates and the way users on old versions will be told to upgrade before you change the secret. Ask any partner for a written rotation runbook that covers rollback.

Which SSO endpoints must be exempted from the header check?

The exact list depends on your identity provider, your SSO method and your client versions, so it should be confirmed in your environment rather than copied from a template. Redirects and callback URLs used during SAML or OIDC sign-in are typical candidates for exemption, because the browser or app must reach them before it has a session. Test each flow end to end, including first sign-in, token refresh and sign-out, and check that exempting an endpoint does not expose other Mattermost paths. The SSO documentation in the Mattermost guide is the natural starting point for the flows you need to verify.

What should a partner quote for this work include?

A quote should list each deliverable in writing: the supported Mattermost version check, the proxy rule design, the endpoint exemption list for each SSO flow, the client build changes, the test cases for web, desktop and mobile, the rotation and rollback runbook, and the handover notes for your team. It should state what is out of scope, such as changes to your identity provider, and what you must provide from the list of access items. Ask how fixed-scope pricing is tied to these deliverables, how retesting after a Mattermost upgrade is handled, and whether ongoing support is a separate retainer.

How DeployOpen scopes and delivers preauth secret work

DeployOpen treats the pre-authentication secret as one control inside a larger proxy and client setup, so the work starts from your current Mattermost version, your proxy and your client mix. The written scope then covers the header rule, the SSO exemptions, the rejection response and the evidence your security team needs to review.

How we scope

  • Inventory which Mattermost server version, mobile and desktop app versions, and reverse proxy you run today.
  • Confirm which mobile and desktop clients must send the header and which versions cannot, before any rule is written.
  • List the SSO and login endpoints that must be exempt, agreed with your identity team in writing.
  • Agree the written scope, deliverables and timeline before work starts; engagements are fixed-scope.

How we build

  • Configure the proxy rule that checks X-Mattermost-Preauth-Secret and returns a 403 response on mismatch.
  • Store the secret value outside configuration files in your own secrets management system, with a planned rotation process.
  • Test allowed clients, blocked unauthenticated requests and each SSO flow against a staging Mattermost server first.
  • Review the proxy rule with your security engineers so exemptions and fallbacks are understood before go-live.

How we hand over

  • Deliver the proxy configuration, exemption list and client version requirements as documented, reviewable artifacts.
  • Provide a test record showing which requests were rejected, which were allowed and why.
  • Document the secret rotation steps and the client rollout steps your team will repeat after each Mattermost upgrade.
  • Walk your operations team through the runbook so ownership of the rule is clear after handover.

How we support

  • Re-check the header rule when Mattermost releases a new server version, since client and proxy requirements can change.
  • Retest exemptions after changes to SSO providers, load balancers or proxy software.
  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped in writing.
  • Quotes follow from the written scope, so ask for the retest and upgrade work to be itemized separately.

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.