Running Mautic behind a reverse proxy: when teams need it and what it changes
This page covers how to run a self-hosted Mautic instance behind an HTTPS reverse proxy or load balancer in infrastructure you control: when the setup is needed, what the proxy changes for the application, and how to keep tracking, email and SAML URLs consistent. TLS usually ends at the proxy, so Mautic receives plain HTTP from it and sees the wrong scheme, host and client IP unless it is told to trust the proxy. Those values feed tracking pixel and link URLs, links inside outgoing emails, redirects after login, and the assertion consumer URL in any SAML single sign-on setup. A mismatch shows up as broken tracking, mixed-content warnings, or login loops that look like identity provider faults.
The decisions to make before changing anything are which proxy addresses Mautic should trust, which host names it should accept, and what the canonical public site URL is. Write these down for each environment (staging and production often differ) and record which proxy headers the proxy sets and whether it overwrites or appends them. Client IP values affect contact tracking, rate limiting and audit logs, so confirm them with a test request from a known address, not by assumption. Also confirm the proxy's own timeouts and body size limits against the upload and campaign-related requests you expect.
Mautic's proxy and trusted host settings have changed over releases, so the exact configuration keys, their names and their defaults must be checked against the documentation for the release you run, such as the Mautic releases page for the supported line and the installation docs for configuration. Confirm the behavior in a staging environment on the same release before cutover, and test a tracking request, a sent test email, a login, and a SAML round trip if you use one. A proxy configuration that works for web pages can still break the URLs Mautic generates for background jobs, so include cron-triggered sends in the test.
Proxy configuration options and when each fits
This table compares the main proxy and load balancer setups for Mautic and what each one changes about TLS, forwarded headers and generated URLs. Read each row against your own traffic path and team, then use the trade-off column to confirm the setup with your Mautic version's documentation before you configure it.
| Option | What it does to requests | When it fits | Trade-off to confirm |
|---|---|---|---|
| TLS terminated at a single edge proxy | HTTPS ends at the proxy, which forwards plain HTTP to the Mautic web server. Mautic must be told which proxy addresses to trust so it reads the original scheme and client IP. | One Mautic web server, one team that owns the certificate, and no requirement for encryption inside the private network. | Forwarded headers become a trust decision. Confirm the exact trusted proxy settings for your release. |
| End-to-end TLS to Mautic | The proxy passes encrypted traffic through, or re-encrypts to the Mautic web server, so the application server also holds a certificate. | Internal traffic policies or assessor expectations require encryption between proxy and application. | More certificate renewal work on the web server and more configuration points that can drift apart. |
| Single reverse proxy | One proxy address sits in front of Mautic and is the only trusted hop for forwarded headers. | Small or single-site installs where one proxy is the only path into the application. | A proxy failure stops all access, including tracking and form submissions. Confirm your recovery path. |
| Load balancer pool | Several web nodes sit behind a balancer, so the trusted list must include the balancer and every address it may use. | Traffic volume or availability needs that justify more than one web node. | Every node must share the same site URL and trusted settings, and sessions must be handled consistently. Confirm session handling with your deployment method. |
| Trusted proxies list | Tells Mautic which upstream addresses may set forwarded client IP and protocol headers. | Any setup with a proxy or balancer in front of Mautic. | Listing too broadly lets clients spoof headers. Listing too narrowly breaks scheme and IP detection after an address change. |
| Trusted hosts list | Limits which host names Mautic accepts in requests, which protects URL generation from header tampering. | Any public domain, including separate domains for tracking or landing pages. | Every public host name must be listed, or requests fail. Check the list after each domain change. |
| Site URL setting | Fixes the base address Mautic uses when it writes links in emails, tracking scripts and SAML callbacks. | Always, once a public domain or HTTPS is in use. | A mismatch with the public scheme produces broken links and failed SSO redirects. Confirm the exact configuration key for your version. |
How to configure trusted proxies, trusted hosts and the site URL
This sequence makes Mautic build its links, redirects and tracking URLs from the public address users see, not the internal address behind the proxy. Each step ends with a check so the settings can be confirmed before go-live.
Confirm the public hostname and scheme
Before changing anything, agree the exact public address Mautic will be served on, including the hostname and whether users reach it over HTTPS. Record it in the change ticket, along with the internal address and port the proxy uses to reach the Mautic web server. Confirm the DNS record and the certificate on the proxy match the hostname. Check: from an outside network, open the public address and confirm the certificate name matches and the page loads over HTTPS without a warning.
Configure the proxy to forward host and protocol headers
The proxy or load balancer, usually run by the infrastructure team, must pass the original host and protocol to Mautic. Typically this means forwarding the X-Forwarded-Host and X-Forwarded-Proto headers, and making sure the proxy does not rewrite the Host header to the internal name. Confirm the exact header names and behavior against the web server and proxy documentation you use. Check: request a test page through the proxy and inspect the headers the Mautic web server receives, which should show the public hostname and https.
Set trusted proxies in Mautic configuration
Add the address or addresses of the proxy or load balancer to the trusted proxies setting in Mautic's local configuration file, usually
config/local.php. Only list the proxies you operate. If the load balancer has addresses that change, ask the platform team for a stable range or the internal subnet. Confirm the key name and format in the configuration reference for your Mautic release, since settings can differ between versions. Check: clear the Mautic cache, then confirm the client IP shown in Mautic's logs is the visitor's address rather than the proxy's.Set trusted hosts to the public hostname
Set the trusted hosts setting in the same configuration file to the public hostname users will reach, and no others. This tells Mautic which Host header values it should accept, which limits requests built from unexpected hostnames. Add any additional hostname only if it is a real entry point you intend to support. Confirm the setting's format and any wildcard rules in your release's documentation before applying a pattern. Check: send a request with the public hostname and one with an unlisted hostname, and confirm the unlisted one is refused while the public one loads.
Set the site URL to the public address
Set the site URL in the Mautic configuration to the full public address, including the https scheme and no trailing path that was not intended. Mautic uses this value when it generates links in emails, landing pages, tracking scripts and redirects, so a wrong value shows up in every outbound link. Clear the cache after the change so the new value is used. Check: open a page that generates a link, such as the login page or a generated form, and confirm every URL in the page source and the rendered links uses the public https address.
Verify login, tracking and form submission
Run three end-to-end tests through the public address. First, sign in as a test user and confirm the session stays on the public hostname. Second, load a page with the Mautic tracking script and confirm the tracking request reaches the public hostname and is recorded against a contact or anonymous visitor. Third, submit a test form and confirm the submission is saved and any redirect points to the public address. Record the results and any errors in the change ticket. Check: all three tests succeed, and the server logs show no mixed-content, redirect loop or host rejection messages for these requests.
Keeping tracking, email and SAML URLs consistent behind the proxy
Mautic needs one canonical public URL, and every place that URL appears has to match it. Tracking scripts, landing pages, form submissions, unsubscribe links, tracked email images and SAML assertion consumer and entity IDs all embed the address Mautic believes it is served from. When the proxy presents to visitors but Mautic generates links for an internal host name or a plain address, the failures appear in different places: the tracking pixel loads over HTTP on a secure page, form posts go to the wrong origin, or unsubscribe links point somewhere that cannot be reached. Decide the public hostname before you configure the proxy, then use it consistently in the site URL setting, the trusted hosts list and the identity provider configuration.
Mismatches usually show up as mixed content warnings in the browser, redirect loops after login or a page that keeps sending visitors back to the sign-in screen. For SAML, a wrong entity ID or assertion consumer service URL causes the identity provider to reject the sign-in request, and the error often names the mismatched value, so compare it against the metadata both sides hold. Before go-live, ask the identity provider team to confirm the exact entity ID and assertion consumer URL they registered, the signing certificate and the attributes they will release. Mautic's authentication documentation requires email, first name and last name attributes, so confirm that the identity provider sends all three under the attribute names you map. The docs describe no LDAP option, so plan for SAML as the single sign-on path if you need it.
How a request flows through the proxy to Mautic
A visitor's browser, or an identity provider completing a SAML sign-in, reaches the load balancer or proxy first, which terminates TLS and is the only component that should set forwarded headers. The proxy passes the request to Mautic web nodes, while cron, queue workers and the database sit alongside them on the internal side of the trust boundary. Check that the proxy overwrites rather than appends forwarded headers, and that the site URL, tracking URLs and SAML endpoints all use the public HTTPS hostname.
Requests enter over HTTPS, get terminated at the proxy, and reach Mautic and its background jobs internally.
Security risks of a misconfigured proxy in front of Mautic
A reverse proxy or load balancer sits between the internet and Mautic, so it decides which client details the application trusts, which hosts it answers to, and what reaches the admin area. Each risk below is a setting that can look correct in a test and still expose the application in production.
Trusting forwarded headers from anyone
Mautic reads client IP and protocol details from forwarded headers only when the proxy addresses are listed as trusted. If the trusted list is too broad, a visitor can send a spoofed X-Forwarded-For value and affect logs, rate limits and any IP-based rule. Check that only the addresses of your own proxy or load balancer tier are trusted, and test by sending a forged header from outside.
Host header outside the trusted list
If Mautic accepts any host name, an attacker can send requests with a different Host value, which can poison generated links and password reset URLs. Confirm that the trusted hosts setting lists only the public domains that serve Mautic, and that the proxy forwards requests for unknown names to nothing useful.
Session cookies without secure flags
Login and session cookies must be marked Secure so browsers send them only over HTTPS, and the proxy must not downgrade traffic to plain HTTP between the browser and Mautic. Check the cookies Mautic sets after login in browser developer tools, and confirm the site URL uses ` so generated links and redirects stay on TLS.
Admin paths reachable through the proxy
Mautic's admin and installer paths should not be open to the whole internet when they are not needed. Ask which paths the proxy publishes, confirm the installer is removed or blocked after setup, and restrict admin access by network or identity provider, since a route that works for tracking may also expose pages you do not intend to publish.
Client IPs and tokens in access logs
Proxy and web server access logs can capture full query strings, which may include tokens, email addresses or campaign parameters. Review the log format on the edge and the origin, decide what client IP fields are kept and for how long, and confirm that logs are restricted to the operations team and are not sent to a shared log platform without review.
Certificate renewal at the edge
TLS terminates at the proxy, so an expired certificate there breaks tracking scripts, form submissions and SAML sign-in at once. Record who owns the renewal process, confirm automated renewal works, and monitor expiry dates for every public name Mautic uses, including any name used by an identity provider callback.
Questions teams ask before running Mautic behind a proxy
What drives the cost of putting Mautic behind a reverse proxy?
The cost is driven mainly by how many environments need changes, how many systems must be reconfigured around the new URL, and how much testing is required before go-live. A single instance behind one proxy with a standard certificate is the smallest case. Costs rise when the proxy or load balancer is shared with other applications, when tracking scripts and forms are already embedded on many websites, or when a SAML identity provider must be updated and tested. Ask any partner for a quote that separates the proxy configuration, the Mautic settings changes, the identity provider work, and the post-change verification, and that states which parts are one-time and which recur, such as certificate renewal and monitoring. No DeployOpen price is stated here; a quote follows from the written scope.
How long does it take to configure Mautic behind a load balancer?
Duration depends on the number of hostnames, the state of the existing proxy configuration, and how many dependent systems must be retested. A basic change to one hostname can be verified quickly, while a change that touches tracking URLs on live websites, email links, and SAML callbacks needs coordinated windows and staged checks. Mautic's own release line affects planning too: the supported versions and their end-of-support dates are listed on the Mautic releases page, so confirm your target version is still in security support before scheduling. Ask for a timeline in the written scope that lists each dependency and its test step.
What does our internal team need to provide before the work starts?
Most engagements depend on five things from your side:
- DNS control over the public hostname and any tracking or form domains
- A valid TLS certificate and the private key handling process your team uses
- Administrative access to the proxy or load balancer, including its forwarded header settings
- Access to the SAML identity provider, if single sign-on is in use, with the ability to update the Mautic entity and attribute mapping
- Network rules that allow the proxy to reach the Mautic web nodes and the database
Confirm each item early, because certificate and identity provider changes often need approvals that take longer than the configuration itself.
Can our own team configure Mautic behind a proxy without outside help?
Yes, a capable platform team can do this internally if it has access to the proxy, the Mautic configuration, and the identity provider, and if it can test each change in a non-production copy first. The main risks are setting trusted proxies too broadly, leaving the site URL pointing at an internal address, and breaking tracking or SAML URLs that were copied into external sites. Internal teams that lack recent experience with Mautic's configuration or with SAML debugging often find that the verification steps take longer than the changes. An outside partner is most useful when you want a documented change, a tested rollback, and an independent check before go-live. Your team should decide based on its own skills and change calendar.
What changes when we add a second Mautic web node behind the load balancer?
A second web node adds session, scheduling, and shared file considerations on top of the proxy settings. Every node must present the same site URL and trust the same proxy addresses, and the installation must point to one shared database. Background work also needs a plan: Mautic relies on cron jobs for segment updates, campaign updates, and campaign triggers, which the documentation says should be staggered, plus a broadcasts command and a messenger consumer when emails are queued. Running these on more than one node without coordination can cause duplicate or conflicting work, so decide which node runs scheduled jobs before you add capacity. Confirm the design with the Mautic cron jobs documentation for your release.
Which problems appear most often after a proxy change?
The most common failures are mixed-content warnings, redirect loops, links that point at an internal hostname or plain HTTP, and tracking scripts that still reference the old address. Mailed links, landing pages, and form submissions often show the problem first, which is why verification should include a test email, a tracked link, and a form submission on each public domain. SAML login failures usually trace to a mismatched callback URL or a missing attribute, since the identity provider must send email, first name, and last name. Keep a record of every URL that changed so you can check each one after cutover.
Is there a Mautic license fee that changes with the proxy setup?
Mautic is licensed under GPL-3.0 according to its GitHub repository, and the software itself has no paid edition. The costs of running it behind a proxy are therefore the infrastructure, the labor to configure and test it, and any managed service you choose to buy. Load balancers, certificates, monitoring, and staff time are the main recurring items. Ask your provider to separate third-party infrastructure charges from services fees, and confirm with your legal team how the GPL-3.0 terms apply to any custom modifications you plan to distribute.
Testing and monitoring the proxy path after go-live
The proxy path needs its own verification after go-live, because a change that looks harmless at the proxy can break tracking, forms or SAML without any visible error on the Mautic login page. Build a short test script that runs after every proxy, load balancer or certificate change. It should load a tracked landing page, submit a form, click a link in a test campaign email and confirm that the contact record shows the correct visit, form submission and click. Check the resulting tracking and form requests in the browser developer tools and confirm they point at the public hostname and HTTPS scheme you set as the site URL, not an internal address or plain HTTP. If your SAML sign-in is enabled, run a test login from a clean browser session as part of the same pass.
Cron and upgrades are the second place where the proxy path breaks quietly. Mautic's segment, campaign and trigger jobs, along with the broadcasts command and any messenger consumer, run on the server and normally call the site URL for their work. Confirm after each change that these jobs still complete, and check that they reach the intended URL rather than a host that the trusted hosts setting now rejects. Repeat this check after every Mautic upgrade, because a new release can change how URLs are generated or how cache paths resolve. Keep a record of the URL each scheduled job uses so the next reviewer can confirm it without reading server configuration from scratch.
Review the web server and Mautic logs for client IP addresses that all show the proxy or load balancer address. That pattern means the trusted proxies setting is missing or incomplete, which weakens rate limiting, geolocation, audit records and the visitor data that depends on IP addresses. Confirm the header configuration with your platform team and the current Mautic configuration reference. DeployOpen can prepare this proxy path, write the test and log review steps into your runbook and run the checks as part of an implementation engagement, with the scope and checks agreed in writing before work starts.

