Metabase behind a reverse proxy with TLS

Terminating TLS in front of self-hosted Metabase needs consistent site URL, HTTPS redirect and forwarded header settings, plus a closed HTTP port and encrypted database connections. This page covers the decisions and checks.

On this page

Metabase reverse proxy with TLS: when your team needs it and what it changes

Once staff reach a self-hosted Metabase from a browser on the corporate network, plain HTTP is no longer acceptable: logins, session cookies and query results would cross the network unencrypted. TLS can be terminated at a trusted reverse proxy in front of Metabase or inside Metabase itself, and the site URL, the HTTPS redirect and the forwarded headers must agree with whichever choice you make. If they do not, users see mixed-content errors, redirect loops or links that point to the wrong scheme. This topic covers only the Metabase side of that arrangement: the settings Metabase needs, the headers it must trust and the ports it should expose. The proxy product, its certificates and its routing rules belong to your network team, though you must confirm they match these settings.

The Metabase JAR runs as a Java service that listens on an HTTP port, by default on the host itself. Once a proxy handles TLS, that port should not be reachable directly from users or from other networks, because a client that connects to it bypasses the proxy's authentication, logging and TLS. Confirm this with your firewall rules, security group or container network configuration, and test it from a host outside the proxy's network. Also check whether any other service on the same host can reach the port, since Metabase trusts the forwarded headers it receives.

Decide early which hop is encrypted and which you verify. Browser-to-proxy traffic needs a certificate your staff's devices trust. Proxy-to-Metabase traffic may stay on a private network, but many security teams require it encrypted too. Metabase's security guidance also expects TLS with certificate validation for the application database and data sources, which is a separate setting you should plan at the same time. Ask your security team which hops they must encrypt, which certificate authority issues the public certificate, and who renews it. The Metabase security best practices for self-hosting page is the authoritative reference for the exact setting names in your Metabase version.

How a browser request reaches Metabase through a TLS proxy

The request starts in the user's browser, which connects to the reverse proxy over HTTPS. That HTTPS connection is the first trust boundary, and the proxy terminates TLS there. The proxy then forwards the request to Metabase on the internal network over HTTP, carrying X-Forwarded-Proto so Metabase knows the original request was secure. Metabase's connections to the application database and data sources should use TLS with certificate validation, which is a separate hop you need to check.

Trust boundaries for a browser request passing through a TLS reverse proxy to Metabase.

Where to terminate TLS: at a proxy or inside Metabase

Terminating TLS at a trusted proxy is the pattern most organizations choose for self-hosted Metabase. The proxy holds the public certificate, accepts HTTPS from users, and forwards plain HTTP to the Metabase JAR or container on a private address. Metabase's security guide describes this setup as a supported option, provided Metabase is told that the public address is HTTPS.

  • Site URL set to HTTPS: Set MB_SITE_URL to the public ` address so links, emails and redirects point at the right scheme.
  • Redirect rule enabled: Set MB_REDIRECT_ALL_REQUESTS_TO_HTTPS to true so plain HTTP requests are sent to HTTPS.
  • Forwarded protocol header: The proxy must send X-Forwarded-Proto: https on every request, or Metabase cannot tell that the original connection was secure.
  • Private listener: Metabase should listen only on an address the proxy can reach, so users cannot bypass the proxy over HTTP.
  • Renewal owned by the proxy team: Certificate issuance and renewal sit with whoever runs the proxy or load balancer, which is usually the platform or network team.

Check that the proxy's certificate renewal is monitored and that a test request over plain HTTP to the Metabase port fails from outside the private network.",

Settings that control HTTPS behavior in Metabase

This table compares the four settings that decide how Metabase builds links and handles HTTP versus HTTPS when a reverse proxy terminates TLS. Read each row for when the setting fits, what breaks when it is wrong, and the value your team should confirm before go-live. The main takeaway is that the proxy, the site URL and the listening port must agree, or users will see mixed content, redirect loops or broken links.

SettingWhen it fitsWhat breaks if it is wrongValue to confirm
MB_SITE_URLAny proxied deployment where users reach Metabase by a public hostname over HTTPSEmails, alerts, subscriptions and embed links point to http or an internal host name, so recipients cannot open themSet to the exact public https URL users type in the browser, including hostname
MB_REDIRECT_ALL_REQUESTS_TO_HTTPSWhen the proxy or Metabase should force every plain HTTP request to HTTPSIf enabled while the proxy still sends HTTP to Metabase without the forwarded protocol header, requests can loop between schemesSet to true only after confirming X-Forwarded-Proto reaches Metabase as https
X-Forwarded-Proto headerProxy terminates TLS and forwards plain HTTP to the Metabase processMetabase thinks the request was plain HTTP, so it generates http links and may trigger redirect loopsProxy sets the header to https on every forwarded request and overwrites any value sent by the client
Metabase listening portMetabase sits on a private network reachable only from the proxyIf the port is reachable from users or other networks, clients can bypass the proxy and its TLS and headersConfirm the port (commonly 3000 by default) is bound only to the proxy's network or host
Application database and data source TLSDatabase traffic crosses a network segment you do not fully controlWithout TLS and certificate validation, credentials and query results can be exposed in transitConfirm the database enforces TLS and Metabase validates the server certificate

Configure Metabase behind a TLS proxy in sequence

This sequence moves a self-hosted Metabase from direct HTTP access to a setup where TLS terminates at a proxy, generated links use HTTPS, and the application port is reachable only from the proxy. Each step ends with a check so you can confirm the previous change worked before making the next one.

  1. Confirm the proxy hostname and trust boundary

    Before touching any configuration, decide the public hostname users will type, such as metabase.example.internal, and identify which proxy or load balancer will hold the certificate. Confirm that the proxy sits inside a network segment your security team controls and that the path from proxy to Metabase is private. Write these decisions down, because the hostname must match the site URL and the certificate name in later steps. Done means you have a named hostname, a named proxy, and a short written diagram showing which hop is encrypted.

  2. Issue and install the certificate at the proxy

    Request a certificate for the public hostname from your internal or public certificate authority, then install the certificate chain and private key on the reverse proxy, following your proxy vendor's documentation. Keep the private key on the proxy only. Check the result from a workstation with a command such as openssl s_client against the hostname, and confirm the chain validates and the subject name matches. Done means the proxy presents a valid certificate for the hostname without browser warnings.

  3. Set the site URL and HTTPS redirect variables

    On the Metabase host, set the environment variable MB_SITE_URL to the full https address of the public hostname, and set MB_REDIRECT_ALL_REQUESTS_TO_HTTPS to true, as described in the self-hosting security guidance. Restart Metabase so the settings load, and keep these values in the same environment file or secrets store as the rest of your configuration. Done means the service starts cleanly and the logs show no startup errors related to these variables.

  4. Forward Host and X-Forwarded-Proto from the proxy

    Configure the proxy to pass the original Host header to Metabase and to set X-Forwarded-Proto to https on every request it forwards. Also set the proxy to redirect plain HTTP requests on port 80 to HTTPS. Reload the proxy configuration, then request the application through the proxy and confirm the response arrives over HTTPS. Done means the proxy configuration validates, and a request to the proxy's HTTP port returns a redirect to the HTTPS address.

  5. Bind Metabase to a private interface

    Limit the Metabase listener to a private interface or loopback address so that clients cannot reach the application directly, bypassing the proxy. On a systemd host, this is commonly handled through the server configuration or a firewall rule; in containers, publish the port only to the proxy network. Then block inbound access to the Metabase application port from anywhere except the proxy. Confirm the scope of this control with your own platform documentation before you rely on it. Done means a direct connection to the application port from a client host fails, while the proxy still reaches it.

  6. Verify the browser experience and redirects

    Open the public hostname in a browser using a plain http address and confirm it lands on the https address without an error. Sign in, load a dashboard, and check the padlock details for the expected certificate. Also run a redirect test with curl using the -I flag against the http address and confirm the response is a permanent redirect to https. Done means both checks pass and no mixed-content warnings appear in the browser console.

  7. Check generated links and sharing URLs

    Metabase builds links for password reset emails, subscriptions, alerts and embedded or public sharing from the site URL. Create a test dashboard subscription or copy a sharing link, and confirm the generated address begins with https and uses the public hostname rather than an internal address or http. If any link points to an internal name, correct MB_SITE_URL and the proxy host header, then repeat this check. Done means every link you generate uses the expected public https address.

  8. Record the configuration for future upgrades

    Save the final proxy configuration, the environment variable values without secret content, and the verification results in your change record. Include this record in the runbook you use for Metabase upgrades, because the same site URL and proxy headers must survive each upgrade and restart. Schedule a repeat of the redirect and link checks after any proxy or certificate renewal. Done means the change record names the owner, the hostname, and the date of the last successful verification.

Encrypting the application database and data source connections

A reverse proxy protects only the browser path. The traffic between Metabase and its application database and between Metabase and each connected data source travels on separate connections, and the proxy does nothing to protect them. Each of those connections needs its own TLS configuration with certificate validation turned on, so that Metabase verifies it is talking to the server it expects and not to something sitting in the middle of the network path.

Start by listing every connection Metabase opens: the application database, each warehouse or operational database used for questions, and any other service Metabase calls. For each one, confirm the driver-level SSL options with the owner of the database, since the parameter names, accepted modes and certificate trust store handling differ between PostgreSQL, MySQL and the various warehouse drivers. Then check the exact settings against the Metabase configuration documentation for your version, because connection options are passed through to the driver and the supported forms can change between releases. Keep the CA bundle used by the Metabase JVM or container in a location managed by your platform team, and record which certificate authority signs each database endpoint.

Metabase's documentation recommends PostgreSQL for the application database in production, so plan for TLS on that connection first. Confirm that the database server accepts encrypted connections, that its certificate chains to a CA your Metabase runtime trusts, and that the connection is set to require validation rather than encryption alone. A test in a non-production environment, where you deliberately present a wrong certificate and confirm that Metabase refuses to start or connect, is a simple way to prove that validation is actually enforced.

Security risks when Metabase sits behind a proxy

A reverse proxy in front of Metabase only protects traffic that actually passes through it. The risks below come from the gaps around the proxy: paths that skip it, headers it trusts too readily, and certificates and database connections that nobody checks after go-live.

Direct access to the HTTP port

If the Metabase port is reachable from the network, a user can bypass the proxy entirely and reach the application without its TLS, access logging or rate limits. Bind Metabase to localhost or a private interface, and restrict inbound rules so only the proxy can reach the port. Test this from a host outside the proxy's network to confirm the path is closed.

Security best practices

Spoofed forwarded headers

Metabase relies on the X-Forwarded-Proto header to decide whether a request arrived over HTTPS. If the proxy passes through a value supplied by the client, an attacker can send headers that the application trusts. Configure the proxy to overwrite forwarded headers on every request rather than append to them, and confirm that clients cannot reach Metabase without going through that proxy.

Session cookies without the secure flag

When TLS ends at the proxy, the application may not mark session cookies as secure, which allows them to be sent over plain HTTP if a user follows an HTTP link. Set the site URL to the HTTPS address and enable the HTTP to HTTPS redirect so that browsers only receive cookies over encrypted connections. Check the cookie attributes in the browser developer tools after the change.

Certificates that expire unnoticed

Certificates on the proxy are often managed outside the Metabase team, so renewal failures can go unseen until users see browser warnings. Track expiry dates for every certificate in the chain, automate renewal where possible, and alert before expiry. Confirm who owns renewal and what happens when the automation fails.

Unencrypted database traffic

TLS in front of Metabase does nothing for the connection between Metabase and its application database or data sources. Enable TLS with certificate validation for those connections so credentials and query results are not readable on the internal network. Check the driver settings for the database, because a connection can succeed while skipping certificate checks.

Admin pages on the public path

Administrative pages should not be reachable from the public internet through the same path as everyday users. Restrict admin routes at the proxy by source network or identity, and review which paths the proxy forwards by default. Include the admin and setup paths in your proxy test plan so you can confirm they are blocked from outside the approved network.

Questions buyers ask about Metabase TLS and reverse proxy setup

How long does a Metabase reverse proxy and TLS setup take?

The duration depends on how many pieces already exist and who has to approve them. A team with a working Metabase, a certificate authority, DNS control and a proxy it already operates may finish the core settings in a short working session, while a new environment with certificate requests, firewall changes and security review can take much longer. The main drivers are certificate issuance, change approval windows, how many hostnames and ingress paths need to be covered, and whether the application database connection must also be encrypted. Ask any partner for a written scope that lists each step and its dependency before agreeing to a timeline.

Can our team configure Metabase behind a proxy without outside help?

Yes, if your engineers are comfortable with their existing proxy and have the access to make changes. The Metabase side is mostly a few settings: the site URL should use https, HTTP should redirect to HTTPS, and the proxy must send the forwarded protocol header that Metabase reads. Metabase's security guidance describes both terminating TLS at a trusted proxy and terminating it inside Metabase itself, so the choice is mainly about where certificates are managed. Outside help tends to be most useful for reviewing exposure of the HTTP port, testing redirect and header behavior, and documenting the result for an assessor.

What does the infrastructure team need to provide for this work?

Plan to provide four things: a fully qualified hostname for Metabase, DNS records that point to the proxy or load balancer, a certificate issued by a trusted authority or your internal CA with its private key handled under your key management rules, and administrative access to the proxy or ingress layer. Network teams also need to confirm which ports are reachable from users and which are blocked from everything except the proxy. If Metabase connects to its application database over TLS, the database team must supply the server certificate chain and confirm that certificate validation is enabled on the Metabase side.

Do TLS and proxy settings change after a Metabase upgrade?

Usually the settings persist in your configuration, but you should verify them after each upgrade rather than assume they carried over. Metabase upgrades run application database migrations automatically, and the upgrade guidance recommends backing up the application database first and upgrading release by release from versions older than 40. Proxy configuration lives outside Metabase, so a proxy or ingress upgrade can change header handling independently. Include a check of the site URL, the redirect behavior and the forwarded protocol header in your upgrade runbook. Confirm the current steps in the upgrade documentation for the version you are moving to.

What is the risk if the HTTP port stays open to users?

Plaintext sessions and credentials can cross the network if users or applications reach Metabase over HTTP before the redirect applies. The safer pattern is to bind Metabase so that only the proxy can reach its port, redirect all HTTP traffic to HTTPS at the proxy, and set the site URL to the https address so that generated links are correct. Test this from outside the proxy network, since a port that is closed at the proxy but reachable on the host is still exposed. Record the test result as evidence for your access and transport controls.

What would a consultant deliver for a Metabase TLS engagement?

A fixed-scope engagement from DeployOpen would normally cover the work agreed in writing before it starts, which for this topic typically includes the site URL and HTTPS redirect configuration, the forwarded header setup at the proxy or ingress, restriction of the HTTP port, and TLS to the application database and data sources. Deliverables should name the configuration files and settings changed, the test results for redirects and headers, and a runbook for upgrades. DeployOpen prepares systems and evidence for compliance assessments but does not issue audit reports or certifications. Ask for the deliverables list and acceptance tests in the written scope before agreeing to a quote.

How is the cost of this setup determined?

Cost follows the scope: the number of environments, the proxy or ingress platform in use, how much certificate and database TLS work is included, and how much testing and documentation the assessor expects. Internal staff time is a one-time cost for the first setup and a recurring cost for each upgrade and certificate renewal. A quote should separate the initial configuration, the verification testing, the runbook, and any ongoing support you want for renewals and upgrades. DeployOpen does not publish a price list, so request a quote based on your written scope.

Limits to confirm in your environment before go-live

The reverse proxy and TLS settings for Metabase depend on details that vary by environment: the release you run, the proxy or load balancer in front of it, and the identity and embedding paths that reach it. Each card below names one item to check, what goes wrong if it is assumed rather than tested, and what to confirm before users arrive.

Setting names for your release

The settings this page relies on, including MB_SITE_URL, MB_REDIRECT_ALL_REQUESTS_TO_HTTPS, and the forwarded protocol header, are named in the security guidance, but the exact behavior can differ between releases. Confirm the version you run and read its configuration reference before you write the environment file. A setting that is silently ignored can leave redirects and links pointing at plain HTTP.

Security best practices

Proxy and load balancer headers

Metabase needs the proxy to send X-Forwarded-Proto with the original scheme, and it must not pass through client-supplied values. Check each hop, including any cloud load balancer, ingress controller or CDN, because a layer that rewrites or drops the header will break the HTTPS redirect. Test with a plain HTTP request from outside and confirm the redirect lands on HTTPS.

Certificate rotation process

Decide who renews the certificate on the proxy, how the new certificate is deployed without a restart window, and what happens if renewal fails. Confirm whether your platform reloads certificates automatically or needs a manual step. Also confirm that the certificate chain is complete, since clients that cannot build the chain will fail before Metabase logs anything.

Embedding and public link origins

Embedded dashboards, public links and the embedding SDK may call Metabase from other origins, and they may need their own allowed domains and frame rules. Confirm which embed paths you use and test them through the same proxy path as the main application. Do not assume that the login origin rules also cover embedded content.

Identity provider callback URLs

Single sign-on callbacks are registered with the identity provider against a specific address. If the site URL changes from HTTP to HTTPS or from one hostname to another, sign-in will fail until the callback list matches. Confirm that every identity provider entry uses the same site URL that Metabase advertises, and test a full sign-in through the proxy.

Application database and data source TLS

TLS between Metabase and the application database, and between Metabase and data sources, is separate from the browser-facing certificate. Confirm that each database driver validates the server certificate against the correct authority, and that the restricted network rules allow only the required ports. Record how each connection is verified so an auditor can see the setting.

Keeping the proxy path working after upgrades and certificate renewals

Re-check the proxy path after every Metabase upgrade and every certificate renewal. The proxy settings that worked on the previous version can stop matching what the application expects. Confirm that MB_SITE_URL still starts with https, that MB_REDIRECT_ALL_REQUESTS_TO_HTTPS is still set as you intended, and that the proxy still sends X-Forwarded-Proto with the value https. Then load the instance through its public address, sign in, open a saved question, and check that the redirects, cookies and any links generated by Metabase use the expected host name and scheme. Do this in a staging copy first where you can, because a mismatch often shows up as a login loop or mixed-content warnings rather than a clear error.

Before an upgrade changes the application database, take a backup of it. Metabase's upgrade guidance recommends this step because migrations run automatically when the new JAR or image starts, and a backup is the cleanest way back if something in the proxy path or the application fails afterward. Record the proxy configuration, the environment variables and the certificate chain in your change record as part of the same change, so you can compare them after the upgrade. Confirm with the upgrade notes for the specific version you are moving to which settings, if any, changed, rather than assuming the previous release's behavior still applies.

Treat certificate renewal as a change to the proxy path, not a routine task. Replace the certificate on the proxy or load balancer, reload it, and then test the public URL from outside your network and from a client that trusts your internal certificate authority if you use one. Check that the certificate covers the host name in MB_SITE_URL and that any clustered or multi-node deployment behind the proxy serves the same certificate on every entry point. Ask your operations team to keep a dated test script with these steps so that renewals, proxy upgrades and Metabase upgrades all follow the same verification.

How DeployOpen scopes and delivers Metabase TLS work

DeployOpen is a Chainscore Labs company that plans, implements, hardens and supports self-hosted open-source platforms inside the client's own infrastructure, including their cloud accounts, data centers and air-gapped networks. For a Metabase TLS engagement, that means the work happens in your environment, under your change control, with your team holding the credentials and the final say on what goes live. Most engagements are fixed-scope, so the scope, deliverables and timelines are agreed in writing before any configuration changes are made.

The written scope for this topic normally covers four areas: the reverse proxy or load balancer that terminates TLS, the Metabase settings that tell the application it is behind HTTPS (such as MB_SITE_URL, MB_REDIRECT_ALL_REQUESTS_TO_HTTPS and forwarded header handling), TLS to the application database and data sources with certificate validation, and verification that the HTTP port is closed to direct access. Ask for the list of proxy products, Metabase version and hosting model (Docker, Kubernetes, systemd or a cloud service) to be stated in the scope, because each changes which files, certificates and health checks are in play. Confirm with your network team which certificate authority and renewal process will be used, since the scope should name who owns certificate issuance after handover.

Quotes follow from the written scope, so a useful quote request lists the components above, the number of environments (for example, test and production), who will perform the changes, and what evidence you expect at the end, such as test results, configuration records and a runbook. Ask whether retesting after a Metabase upgrade is included or priced separately, because upgrades can change proxy behavior. DeployOpen does not publish a price list, and any cost or duration should come from the signed scope rather than from general estimates.

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.