Why Rocket.Chat needs a reverse proxy with TLS in front of it
If you are deploying self-hosted Rocket.Chat, you need to decide how HTTPS, certificates and client IP handling reach the application before users connect. Rocket.Chat advises terminating SSL at a reverse proxy rather than in the application itself. The proxy holds the certificate, accepts HTTPS from users and forwards plain traffic to the Rocket.Chat container. Any deployment reachable from the internet or from another network segment needs this layer, and the same reasoning applies to remote staff, partner access and mobile clients on public networks. This topic covers the two proxies most teams consider for Rocket.Chat: Traefik and Nginx.
Two settings must agree with the proxy design. HTTP_FORWARDED_COUNT tells Rocket.Chat how many proxies sit in front of it, and the documented default is 1. If you chain more than one proxy, for example a cloud load balancer in front of Traefik, the value must match the real number of hops, or Rocket.Chat will read the wrong client address. Second, the proxy must ignore client-supplied X-Real-Ip headers. Rocket.Chat's security guidelines warn that trusting these headers can let a caller bypass rate limits by sending a different address on every request. Confirm the hop count in your own network diagram before go-live, and test it with requests from two different source addresses.
The choice between Traefik and Nginx mostly affects certificate handling and operations. With Traefik, the Docker Compose path can request and renew Let's Encrypt certificates when LETSENCRYPT_ENABLED and TRAEFIK_PROTOCOL are set as the official documentation describes. With Nginx, you set up Certbot yourself. If you hold certificates from your own certificate authority, confirm who issues, installs and rotates them, and where the private key is stored. Whichever proxy you use, plan the WebSocket path as a requirement, not an afterthought, because Rocket.Chat's real-time messaging depends on it. The sections that follow walk through each proxy and the checks to run.
Choosing Traefik or Nginx for the Rocket.Chat edge
Traefik is the path with the least manual work when Rocket.Chat runs from the official rocketchat-compose repository on a single Docker host. The compose setup includes Traefik as the edge, so you set the proxy behaviour through .env values rather than writing routing rules by hand. When LETSENCRYPT_ENABLED=true and TRAEFIK_PROTOCOL=https are set, Traefik obtains and renews Let's Encrypt certificates itself, which removes a recurring certificate task from the operations calendar.
- Automatic certificates: Let's Encrypt issuance and renewal run inside Traefik once both variables are set.
- Docker provider: Traefik reads container labels and generates routes as services start, so routing follows the compose file.
- Metrics and access logs: Traefik exposes Prometheus and other metrics and writes JSON or CLF access logs, which feed the monitoring stack you plan separately.
- Config changes without restarts: Route updates from the provider are applied without restarting the proxy.
- Forwarded headers: Set
HTTP_FORWARDED_COUNTto match the number of proxies in front of Rocket.Chat and confirm clientX-Real-Iphandling at the edge.
Confirm that your compose version and .env keys match the release you pin, and that ports 80 and 443 reach the host for the certificate challenge.
Nginx is a reasonable choice when your organization already operates it, its standard configuration is reviewed, and your security team expects it at the edge. Rocket.Chat's documentation covers the Traefik automation path, and the Nginx path needs manual Certbot setup. You therefore own certificate issuance, renewal hooks, reload behaviour and the proxy configuration for WebSocket upgrades.
- Manual certificate lifecycle: Certbot issuance, renewal scheduling and post-renewal reloads must be built and tested by your team.
- WebSocket upgrade headers: Rocket.Chat relies on WebSocket traffic, so the Nginx location block must pass upgrade headers correctly.
- Forwarded headers: Configure Nginx to set forwarding headers and to avoid trusting client-supplied
X-Real-Ip, then matchHTTP_FORWARDED_COUNTto the proxy chain. - Own certificates: If your organization issues certificates from an internal CA, Nginx works the same way, with certificate paths managed by your PKI process.
- Existing controls: Reuse logging, WAF and rate-limit policies your team already audits instead of introducing a second edge product.
Ask your security team which edge product they already monitor and patch, and test certificate renewal in staging before go-live.
On Kubernetes, the edge choice is shaped by the ingress layer that already exists. Traefik supports Kubernetes providers including Kubernetes CRD, Kubernetes Ingress and Kubernetes Gateway API, so routes can be declared as Kubernetes resources. Traefik's Kubernetes Ingress NGINX provider supports many ingress-nginx annotations, which the Traefik documentation presents as a path for moving from the retired NGINX Ingress Controller with minimal configuration changes.
- Kubernetes providers: Choose between CRD, Ingress and Gateway API resources based on what your platform team already maintains.
- Ingress NGINX migration: Annotation compatibility reduces rewrite work, but test each annotation your current Ingress resources use.
- Rocket.Chat Helm chart: Confirm how the chart exposes the service and which TLS options your OpenShift or Kubernetes setup expects.
- Load balancing and WebSockets: Verify that sticky or WebSocket-aware routing works for every Rocket.Chat instance before scaling out.
- Scope of support: Traefik Proxy is the open-source product; Traefik Hub and Traefik Enterprise are separate offerings.
Confirm the ingress-nginx annotations in use and run a WebSocket session test through the new controller.
Whichever proxy you choose, it becomes part of your patch cycle. Traefik usually ships three or four minor versions a year, and each minor version is supported until the next one is released, so the proxy can move faster than Rocket.Chat's own release line. Traefik v3.7.15 and v2.11.59 were both published on October 15, 2026, which shows that more than one major line can receive updates at the same time. Nginx has its own release and vendor support model, which your team should review separately.
- Short support window: Plan an upgrade to a supported Traefik minor version on a schedule your team can keep.
- Pinned images: Pin the Traefik image and the Rocket.Chat release together, and record both in change control.
- Config drift: Labels,
.envvalues and Helm values for the edge should live in version control. - Certificate continuity: Test that a proxy upgrade keeps existing Let's Encrypt account data and certificates.
- Vendor support: If you need commercial support, confirm which Traefik product and support terms apply, since the open-source proxy and paid offerings differ.
Ask who will apply proxy security advisories and how quickly that team can roll out a patched edge.
Reverse proxy and certificate options compared
This table compares the main ways to terminate TLS in front of Rocket.Chat, from the Traefik path in rocketchat-compose to Nginx and Kubernetes ingress. Read each row for who handles certificate issuance and renewal, which setup suits your environment, and what your team must confirm before go-live.
| Option | Certificate handling | When it fits | What to confirm |
|---|---|---|---|
| Traefik with Let's Encrypt via rocketchat-compose | Traefik obtains and renews Let's Encrypt certificates when LETSENCRYPT_ENABLED=true and TRAEFIK_PROTOCOL=https | Single-host Docker Compose deployments where the server is publicly reachable for certificate validation | Public DNS record points to the host, ports for validation are open, and the chosen Compose files match your release |
| Traefik with your own certificates | You supply certificate and key files and mount them into Traefik's file provider configuration | Internal hostnames, or organizations that issue certificates from an internal CA | Certificate chain includes intermediates, key file permissions, and who rotates files before expiry |
| Nginx with Certbot | Certbot is set up manually on the host and renewal is scheduled by your team | Teams already running Nginx on the host who want direct control of the proxy configuration | Renewal job is tested, reload hook is in place, and WebSocket upgrade headers are configured |
| Nginx with your own certificates | Certificate and key are placed on the host and referenced in the Nginx server block | Internal CA or purchased certificates managed by an existing PKI or certificate process | Who owns renewal and redeployment, and whether the certificate covers the Rocket.Chat hostname |
| Kubernetes ingress with an ingress controller | TLS is terminated at the ingress or gateway, often using a secret that holds the certificate | Deployments on Kubernetes or OpenShift, including the official Helm chart path | Ingress class, certificate secret source, and how the controller's real client IP handling affects HTTP_FORWARDED_COUNT |
| Traefik on Kubernetes with ingress-nginx annotations | Traefik's Kubernetes Ingress NGINX provider reads supported annotations, and certificates come from the configured source | Teams moving off the retired NGINX Ingress Controller with minimal configuration change | Which annotations your current manifests use and whether each one is supported before cutover |
| Any option with an upstream load balancer or CDN | The outer layer may terminate TLS, and the proxy behind it re-encrypts or forwards traffic | Organizations with a corporate edge, WAF or cloud load balancer in front of Rocket.Chat | Number of proxy hops for HTTP_FORWARDED_COUNT and that the edge overwrites client X-Real-Ip headers |
Let's Encrypt or your own certificates
The first decision is where the certificate for your Rocket.Chat hostname comes from. Let's Encrypt issues and renews certificates automatically, which removes a recurring manual task, but it only works when the public internet can reach the hostname for validation. With Traefik and rocketchat-compose, setting LETSENCRYPT_ENABLED=true and TRAEFIK_PROTOCOL=https lets Traefik obtain and renew the certificate, and Traefik can also issue wildcard certificates if your naming scheme calls for them. The Nginx path requires you to set up Certbot yourself, so plan that work separately.
Public issuance does not fit every network. A workspace reachable only from a corporate network, a private data center, or an air-gapped environment usually cannot complete the validation step, and many security teams do not want internal hostnames published in public certificate transparency logs. In those cases, request the certificate from your internal PKI or a commercial CA, and make sure the proxy serves the full chain. Clients and the desktop and mobile apps must also trust the issuing CA, so confirm that your managed devices already distribute the root and intermediate certificates before you cut over.
Before you choose, confirm three things with your security and network teams: the DNS records that point to the proxy, the challenge method your environment allows (HTTP-01 requires port 80 reachable from the internet, while DNS-based challenges need DNS provider access for automation), and the renewal process for certificates you issue yourself. Renewal failures are a common cause of outages, so decide who gets alerted when a certificate is close to expiry and where that alert comes from.
Where the proxy strips client headers before Rocket.Chat sees the request
The diagram starts with a browser sending HTTPS requests and WebSocket upgrades to the TLS-terminating proxy, either Traefik or Nginx. At the edge, the proxy drops any client-supplied X-Real-Ip header and sets its own forwarding headers before passing traffic to Rocket.Chat. Rocket.Chat then reads the client address using HTTP_FORWARDED_COUNT, which must match the number of proxies in the path. Check that the proxy is the only entry point, so rate limits apply to the real client address.
Traffic path through the TLS proxy, with the edge trust boundary where client headers are removed.
Setting up TLS termination and forwarded headers for Rocket.Chat
This sequence takes a Rocket.Chat workspace from a resolvable hostname to a verified HTTPS endpoint where the proxy handles certificates, forwards client addresses correctly, and keeps rate limits working.
Confirm DNS and the public hostname
Before touching compose files or proxy configuration, confirm that the public hostname you plan to use resolves to the address of the machine or load balancer that will run the proxy. Check the A or AAAA record from outside your network, not only from inside it, and confirm that inbound TCP 80 and 443 reach the host. For Let's Encrypt HTTP validation, port 80 must be reachable from the internet. If your certificates come from an internal CA, confirm the hostname matches the name you will put on the certificate. Done means a lookup from an external resolver returns the expected address and a test connection to port 443 completes.
Choose the proxy and certificate source
Decide whether Traefik or Nginx will terminate TLS, and whether certificates will come from Let's Encrypt or your own certificate authority. Traefik is the path where the official rocketchat-compose setup can obtain and renew Let's Encrypt certificates for you. With Nginx, you configure Certbot or your own certificate tooling yourself. Record the decision, the hostname, and who owns certificate renewal and key storage. Done means a written note names the proxy, the certificate source, and the team responsible for renewal, so the choice is reviewable before configuration begins.
Set Let's Encrypt and protocol variables for Traefik
For the Traefik path in rocketchat-compose, set LETSENCRYPT_ENABLED to true and TRAEFIK_PROTOCOL to https in the .env file, along with the public hostname that Traefik should request. For Nginx, skip these variables and instead install Certbot, obtain a certificate for the same hostname, and point the server block at the issued files. Confirm the setting by starting the stack and watching the Traefik logs for a successful certificate issuance. Done means the browser loads the hostname over HTTPS with a certificate whose subject matches the hostname and whose issuer is the expected authority.
Set HTTP_FORWARDED_COUNT to the proxy count
Set HTTP_FORWARDED_COUNT in the Rocket.Chat environment to the number of proxies between clients and the Rocket.Chat container. A single Traefik or Nginx instance means one proxy, which matches the documented default of 1. If you chain a cloud load balancer in front of the proxy, count it as well. Get this value wrong and Rocket.Chat will read the wrong client address from the forwarded chain, which affects rate limiting and audit records. Done means the value in the running container matches the number of proxy hops you documented, and a request from a known address shows that address in the application logs.
Overwrite or strip client X-Real-Ip headers
Configure the proxy so it sets X-Real-Ip itself from the connection it received, and drops any X-Real-Ip value a client sent. Rocket.Chat's security guidance warns that trusting client-supplied X-Real-Ip can allow rate-limit bypass, because an attacker can rotate fake addresses. In Traefik, use the forwarded-header and trusted-IP settings for the entry point; in Nginx, set proxy_set_header X-Real-Ip to the remote address variable rather than passing the incoming header through. Done means a request sent with a spoofed X-Real-Ip header shows the real source address in Rocket.Chat logs, not the spoofed value.
Enable WebSocket upgrade on the proxy
Rocket.Chat relies on persistent WebSocket connections for live messages, presence and typing indicators. Confirm the proxy passes the Upgrade and Connection headers and does not impose a short idle timeout on the WebSocket path. Traefik supports WebSocket natively on routes it creates; in Nginx, set proxy_http_version 1.1 and the upgrade headers for the Rocket.Chat location. Done means the browser's developer tools show a successful WebSocket connection to the workspace URL with a 101 response, and the connection stays open while the page is idle.
Verify login, live messages and rate limits
Test the full path with three checks. First, sign in with a test account over HTTPS and confirm the session persists after a page reload. Second, open the workspace in two browser sessions, send a message from one, and confirm it appears in the other without a manual refresh, which proves the WebSocket path works. Third, trigger repeated failed logins from one client and confirm Rocket.Chat's rate limiting responds, then repeat with a spoofed X-Real-Ip header and confirm the limit still applies to the real source. Done means all three checks pass, and the results are recorded with the test date, the hostname, and the proxy configuration version.
WebSocket traffic and what breaks it
Rocket.Chat keeps a persistent connection open for every browser and desktop client, so messages reach users without a page refresh. Most proxy failures on this path look like a working login with missing or stale messages, which makes the WebSocket path worth checking explicitly after every proxy change.
Upgrade headers must pass through
Clients open the realtime channel with an HTTP upgrade request. The proxy has to forward the Upgrade and Connection headers to the Rocket.Chat instance and must not strip them as hop-by-hop headers. Traefik handles WebSocket upgrades by default, but a custom Nginx location block often omits the two directives. Test by opening the browser developer tools, filtering for WebSocket frames, and confirming that the connection stays in the open state after login.
Idle timeouts close quiet sessions
A user who reads without typing can leave a connection idle for long periods, and many proxies close idle upstream connections after a default timeout. When that happens, the client reconnects and may miss events in the gap. Check the read and send timeouts in your Nginx or Traefik configuration against the behavior your users expect, and confirm the setting with your load balancer or cloud provider if it sits in front of the proxy.
Sticky routing across several instances
When more than one Rocket.Chat instance sits behind one load balancer, each client's WebSocket session must stay on the instance that owns it, and HTTP requests for the same session should follow the same path. Configure session affinity at the proxy and confirm it with your team before scaling out. Multi-instance designs also require a paid plan, and the NATS-based setup is covered in the scaling topic on running multiple instances with NATS.
HTTP/2 and gRPC support in Traefik
Traefik supports WebSocket, HTTP/2 and gRPC, so a single entry point can serve browser traffic and any other protocols your environment exposes. Keep the Rocket.Chat service definition on HTTP/1.1 for the realtime path unless your tested version confirms otherwise. Verify this after each Traefik upgrade, since minor versions ship several times a year and each one is supported only until the next release.
Traefik READMESymptoms that point to the proxy
The most common sign is a message that appears only after a manual refresh, presence indicators that never change, or typing notices that do not reach other users. Login and channel browsing may still work because they use ordinary HTTP requests. Collect the browser console output, the proxy access log for upgrade requests, and the Rocket.Chat server log for disconnect events before changing settings, so you can tell a proxy fault from an application fault.
Questions teams ask before a reverse proxy and TLS setup
What does a reverse proxy and TLS setup for Rocket.Chat cost in effort?
Effort depends mostly on how many moving parts sit in front of Rocket.Chat, not on the proxy product alone. A single host running the official Docker Compose setup with Traefik and Let's Encrypt is the smallest case. Effort rises when you add a corporate load balancer, a certificate authority you must integrate with, multiple Rocket.Chat instances, WebSocket handling across several hops, or an existing Nginx configuration you must preserve. Ask any provider for a written scope that lists each proxy layer, each certificate source and each environment (test and production) so the quote reflects the actual work. Ongoing cost is mostly certificate renewal monitoring and proxy upgrades, which recur on your team's calendar.
How long does it take to scope a Rocket.Chat proxy and TLS job?
Scoping time depends on what has to be discovered before anyone can write a configuration. The main inputs are your network path from the internet to the Rocket.Chat host, whether a firewall or load balancer already terminates TLS, which certificate policy applies, and whether the team already runs Traefik or Nginx. Teams with a clear network diagram and an agreed certificate authority can scope quickly. Teams that must first confirm who owns DNS, firewall rules and the internal certificate chain will need more time. Ask for the scoping steps and the questions they answer, rather than a fixed number of days, because the schedule should follow from those answers.
What does our team need to provide before proxy and TLS work starts?
Most delays come from access and decisions, not from configuration. Prepare the following before work starts:
- DNS control for the public hostname, so a record can point at the proxy and a Let's Encrypt challenge can complete.
- A certificate policy: Let's Encrypt, an internal CA, or a commercial certificate, plus who approves renewals.
- Network access: inbound ports 80 and 443 where HTTP challenges are used, and the path between the proxy and the Rocket.Chat host or cluster.
- Information about any existing load balancer, WAF or CDN, including whether it terminates TLS and what headers it adds.
- A test hostname and a maintenance window for the cut-over.
Confirm each item with your network and security owners early.
Can an internal IT team set up Rocket.Chat behind a proxy without outside help?
Yes, a competent team can do this internally if it has Docker or Kubernetes skills, access to DNS and firewalls, and someone who understands TLS and proxy headers. The official Docker Compose path with Traefik handles Let's Encrypt automatically when LETSENCRYPT_ENABLED and TRAEFIK_PROTOCOL are set as documented, while the Nginx path needs manual Certbot work. The harder parts are rate-limit correctness, WebSocket behavior through every hop, and the verification that proves client IP handling is right. Decide in advance who owns renewals and upgrades after go-live, because the proxy configuration must be revisited with each Rocket.Chat release.
What breaks if HTTP_FORWARDED_COUNT is set wrong?
Rocket.Chat uses HTTP_FORWARDED_COUNT to decide how many proxy hops to trust when reading the client address. The default is 1. If the value is too low, Rocket.Chat sees the address of an intermediate proxy instead of the real client, so rate limits can treat many users as one source and lock them out. If the value is too high, Rocket.Chat trusts more forwarded addresses than exist, so a client can supply a fake address and dodge rate limits. Separately, proxies should ignore client-supplied X-Real-Ip headers, because otherwise an attacker can set that header directly. Test by sending requests from two known addresses through your actual proxy chain and checking which address appears in the logs.
How do Rocket.Chat upgrades affect the proxy configuration?
Upgrades can change what the proxy must do, so the proxy configuration belongs in the upgrade plan. Review the release notes for changes to WebSocket paths, required headers, or environment variables, and retest HTTP_FORWARDED_COUNT after any change to the number of proxies. Proxy upgrades follow their own cadence: Traefik ships several minor versions a year and each is supported until the next release, so pin versions and track them. Standard Rocket.Chat releases are supported for 6 months and LTS releases for 12 months, and unsupported versions can lose mobile and desktop client connectivity. Plan a staging test of the full chain before each production upgrade.
Should we use Traefik or Nginx in front of Rocket.Chat?
The choice is mainly about how certificates are managed and what your team already operates. Traefik fits the official Docker Compose path, where it can obtain and renew Let's Encrypt certificates automatically and generate routes from container labels. Nginx is a familiar choice for teams with existing configuration standards, but the Let's Encrypt renewal and reload process must be built and monitored by your team. Your choice should also reflect the orchestrator you run, because Traefik has providers for Docker, Kubernetes and other platforms. Confirm that the proxy you choose supports WebSocket traffic at the version you will run.
Running the proxy after go-live
The proxy becomes part of the Rocket.Chat security boundary once users depend on it, so ongoing proxy operations should be owned by a named team with alerts on certificate renewal, access log retention and proxy metrics. With Traefik and the rocketchat-compose path, Let's Encrypt renewal is automatic when LETSENCRYPT_ENABLED=true and TRAEFIK_PROTOCOL=https are set, but automatic renewal can still fail silently after DNS, firewall or port changes. Confirm that the ACME challenge still works from the public internet, and alert on certificate expiry from outside the proxy. With Nginx and Certbot, confirm that the renewal timer or cron job exists, runs as expected and reloads Nginx after renewal. For certificates you supply, record the expiry date and the owner of the renewal process.
Upgrades have two tracks: Traefik and Rocket.Chat. Rocket.Chat standard releases are supported for 6 months and LTS releases for 12 months, and after end of life a version gets no security fixes and some cloud services stop working, so plan proxy changes alongside Rocket.Chat upgrades rather than as separate events. Traefik ships three or four minor versions a year and each one is supported until the next release, so pin the Traefik image tag, read the release notes for each upgrade, and test WebSocket behavior and forwarded headers in staging first. Keep access logs in JSON or CLF format with a retention period set by your security and compliance policy, since they are the main evidence when investigating abuse or rate-limit problems. Prometheus metrics from Traefik should feed the same monitoring stack as the rest of your Rocket.Chat deployment.
Retest rate limits after every proxy change, including Traefik version upgrades, middleware edits, new load balancer instances and changes to HTTP_FORWARDED_COUNT. A change in proxy depth can quietly move the client address that Rocket.Chat sees, which affects both rate limits and audit records. Send controlled test traffic from a known address, confirm that client-supplied X-Real-Ip values do not change the recorded address, and check that the rate limit triggers at the expected threshold. Keep this test in a written runbook with the expected results, and record who ran it and when. Do not treat a passing login page check as proof that rate limiting and forwarded-address handling still work.

