Introducing a new way to review your PRs.

Read the announcement

frappe / frappe_docker

Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development

View on GitHub

15 documents · Updated Nov 23, 2026

docs / networking-tls-and-proxy-options

Networking, TLS, and proxy options

The networking layer controls how users reach a Frappe bench and how the bench receives the original host and protocol. Compose overrides select direct HTTP access, an in-stack reverse proxy, or a shared proxy for several benches. TLS options add certificate issue and renewal through Let's Encrypt, while custom-domain options route many public names to one site. See Container stack architecture for the stack context and Runtime startup and web serving and Compose service topology variants for related request and deployment paths.

Access paths

The base stack serves the application through the frontend service on its configured internal port. A proxy override decides whether that service is published directly or reached through a routing service.

Access pathPublic entryMain use
Direct accessfrontend on HTTP_PUBLISH_PORT, default 8080Local or private HTTP access without a reverse proxy
Single-stack Traefikproxy on HTTP or HTTPSHost and rule based routing for one stack
nginx-proxynginx-proxy on HTTP or HTTPSSimple host based routing with environment driven host names
Shared TraefikA separate Traefik stack on traefik-publicSeveral benches or Compose projects on one public entry point

The public proxy forwards requests to the frontend. The frontend then serves assets and sends application requests to the backend and WebSocket requests to the WebSocket service. This keeps public routing separate from the internal application path. Direct access does not trust forwarded protocol headers by default, while the proxy paths do; change this setting only when the upstream path is trusted.

This diagram shows the common request path from a client to the bench services.

flowchart LR
    Client[Client] --> Entry[Public entry point]
    Entry --> Frontend[Frontend]
    Frontend --> Backend[Backend]
    Frontend --> Websocket[WebSocket service]

References: compose.yaml• L46-81 overrides/compose.noproxy.yaml• L1-6 overrides/compose.proxy.yaml• L1-23

Direct HTTP access

The no-proxy path publishes the frontend directly. It is the simplest path for a private network or for a deployment that uses a separate proxy outside this Compose project.

overrides/compose.noproxy.yaml maps HTTP_PUBLISH_PORT to the frontend's NGINX_LISTEN_PORT, which defaults to 8080. This path does not provide host routing, TLS, or certificate management inside the stack. It disables trust in forwarded protocol headers by default because no proxy is present in this path.

References: overrides/compose.noproxy.yaml• L1-6

Single-stack reverse proxy

The single-stack proxy paths place a reverse proxy beside the bench and publish the proxy rather than the frontend. The proxy discovers the frontend and sends public traffic to its configured NGINX_LISTEN_PORT.

Traefik HTTP routing

compose.proxy.yaml runs Traefik for HTTP traffic. It exposes only services that declare routing labels and accepts any host through its default rule. The frontend route targets NGINX_LISTEN_PORT, while HTTP_PUBLISH_PORT changes the host port without changing the internal proxy port.

References: overrides/compose.proxy.yaml• L1-23

Traefik HTTPS routing

compose.https.yaml extends the Traefik path with HTTP-to-HTTPS redirection and a Let's Encrypt resolver. The site rule comes from SITES_RULE, and the certificate account uses LETSENCRYPT_EMAIL. Certificate state persists in the cert-data volume.

Use this path when the bench needs rule-based routing and the stack can receive public traffic on the challenge and HTTPS ports. The HTTP and HTTPS host ports remain configurable through HTTP_PUBLISH_PORT and HTTPS_PUBLISH_PORT.

References: overrides/compose.https.yaml• L1-34 docs/…/01-tls-ssl-setup.md• L9-26

nginx-proxy HTTP routing

compose.nginxproxy.yaml runs nginx-proxy and gives it the host list in NGINX_PROXY_HOSTS. nginx-proxy uses that list to send matching host requests to the frontend on NGINX_LISTEN_PORT, which defaults to 8080. Its certificate, HTML, and virtual-host data use named volumes so proxy state can survive container replacement.

This path favors simple host based routing. It does not provide the rule flexibility of Traefik.

References: overrides/compose.nginxproxy.yaml• L1-24 docs/…/04-nginx-proxy-acme-companion.md• L9-15

TLS certificate paths

TLS terminates at the selected public proxy. The Compose overrides then keep certificate state in a volume and use a certificate resolver or companion service to obtain and renew public certificates.

Traefik certificate management

The in-stack Traefik HTTPS path uses an HTTP challenge. The shared Traefik HTTPS path uses a TLS challenge and stores its state in cert-data. Both paths require public DNS and a reachable challenge entry point.

The shared path separates the public proxy from each bench. compose.traefik-ssl.yaml protects the Traefik dashboard with HTTPS and Basic authentication. It uses the le resolver and the EMAIL value for certificate requests. It does not by itself add HTTPS to a bench; each bench needs the SSL multi-bench override.

References: overrides/compose.https.yaml• L10-34 overrides/compose.traefik-ssl.yaml• L1-50 docs/…/01-tls-ssl-setup.md• L18-26

nginx-proxy certificate management

compose.nginxproxy-ssl.yaml adds the ACME companion to the nginx-proxy path. The companion reads LETSENCRYPT_HOST from the frontend and uses LETSENCRYPT_EMAIL for certificate requests. It shares the proxy's certificate and virtual-host volumes so nginx-proxy can serve the issued certificates.

Use both nginx-proxy overrides for HTTPS. NGINX_PROXY_HOSTS supplies both the routing names and the certificate names.

References: overrides/compose.nginxproxy-ssl.yaml• L1-28 docs/…/04-nginx-proxy-acme-companion.md• L46-73

Shared multi-bench routing

The shared Traefik model gives several benches one public routing network while keeping each bench on its own internal network. A dedicated Traefik stack attaches to traefik-public; each bench attaches its frontend to that network and gives its route a distinct ROUTER name.

SITES_RULE selects the public host or host pattern for a bench. The frontend remains connected to the bench network so it can reach the application services. The other bench services join their private bench and shared database networks as needed.

This diagram shows how one public proxy can route to separate benches without merging their private service paths.

flowchart LR
    Client[Client] --> Proxy[Shared Traefik]
    Proxy --> BenchA[Bench A frontend]
    Proxy --> BenchB[Bench B frontend]
    BenchA --> PrivateA[Bench A private services]
    BenchB --> PrivateB[Bench B private services]
    Proxy --- Public[traefik-public network]

References: overrides/compose.traefik.yaml• L1-46 overrides/compose.multi-bench.yaml• L1-52 docs/…/01-tls-ssl-setup.md• L18-26

SSL multi-bench routing

compose.multi-bench-ssl.yaml adds an HTTPS router for each bench and redirects its HTTP router to HTTPS. The router uses the shared Traefik le certificate resolver and applies SITES_RULE to the HTTPS route.

The shared Traefik stack must provide the HTTPS entry point and the le resolver. The bench SSL override only describes the bench route; it does not create a proxy or certificate store.

References: overrides/compose.multi-bench-ssl.yaml• L1-14 overrides/compose.traefik-ssl.yaml• L1-50

Custom domain routing

The custom-domain path adds a small Caddy service between Traefik and the frontend. Caddy accepts traffic on an internal port and forwards it to the frontend, while Traefik applies the public route and sets the request host expected by the bench.

SITES_RULE defines which public names match the route. BASE_SITE identifies the site that receives the request inside the bench. ROUTER keeps the Traefik service and router names unique, and BENCH_NETWORK identifies the external network that reaches the bench.

The HTTP custom-domain override attaches the Caddy service to both the shared public network and the bench network. The SSL variant adds HTTPS as a second entry point and uses the shared le resolver for the custom-domain route.

References: overrides/compose.custom-domain.yaml• L1-29 overrides/compose.custom-domain-ssl.yaml• L1-5

Networking requirements

The selected proxy model must match the networks and public ports available to the deployment. Public certificate issue also depends on DNS and on the challenge request reaching the proxy.

Key requirements are:

  • Public DNS names point to the server that publishes the proxy.
  • Ports 80 and 443 are reachable when the chosen ACME challenge needs them.
  • ROUTER values are unique across benches that share Traefik.
  • SITES_RULE matches the names that users send in the request.
  • Shared-network names match the external networks created for the proxy and bench.
  • Certificate volumes remain attached to the same proxy deployment during updates.

References: docs/…/01-tls-ssl-setup.md• L53-57 docs/…/04-nginx-proxy-acme-companion.md• L17-37 overrides/compose.multi-bench.yaml• L45-52

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep NGINX_LISTEN_PORT aligned with every proxy target and published access path.
  • Keep forwarded-protocol trust disabled for direct access unless a trusted upstream proxy is present, and enabled for proxy paths only when their upstream chain is trusted.
  • Keep HTTP and HTTPS router names and middleware names consistent between the shared Traefik stack and each multi-bench stack.
  • Keep certificate resolver names and certificate storage paths aligned between the Traefik base and SSL overrides.
  • Keep NGINX_PROXY_HOSTS and LETSENCRYPT_HOST aligned when host names or certificate coverage change.
  • Keep ROUTER, SITES_RULE, BASE_SITE, and BENCH_NETWORK coordinated across custom-domain labels and the networks they use.
  • Preserve the shared certificate and proxy data volumes when replacing proxy containers.

Important failure modes

TriggerConsequenceGuard
A host name does not resolve to the proxy serverACME cannot complete and users reach the wrong endpointCheck DNS before enabling a public certificate
Port 80 or 443 is blocked for the selected challengeLet's Encrypt does not issue or renew the certificateAllow the required public ports or use a proxy and challenge path that is reachable
A bench uses a resolver or entry point that the shared Traefik stack does not defineThe HTTPS route has no working certificate pathTreat the shared Traefik SSL override as the source of resolver and entry-point names
Two shared benches reuse a ROUTER nameLabels can target the wrong service or replace another routeUse one unique router name per bench
SITES_RULE does not match the request hostThe proxy returns no bench routeTest each public name against the rule before deployment
The custom-domain service cannot join traefik-public or BENCH_NETWORKTraefik cannot reach the route targetCreate both external networks with the names used by the overrides
Proxy certificate volumes are removedExisting certificates and ACME state are lostRetain the named certificate and ACME volumes

Key files

FileWhy to read it
compose.yamlDefines the frontend endpoint and the internal backend and WebSocket path used by all proxy choices
overrides/compose.noproxy.yamlShows direct frontend publication and its forwarded-protocol trust default
overrides/compose.proxy.yamlShows the basic single-stack Traefik HTTP path and frontend port target
overrides/compose.https.yamlShows single-stack HTTPS, redirect, ACME, and certificate persistence
overrides/compose.nginxproxy.yamlShows nginx-proxy host routing, frontend port target, and proxy state
overrides/compose.nginxproxy-ssl.yamlShows ACME companion integration and HTTPS publication
overrides/compose.traefik.yamlShows the shared Traefik public network and protected dashboard route
overrides/compose.traefik-ssl.yamlShows shared Traefik HTTPS, its TLS challenge, and certificate resolver
overrides/compose.multi-bench.yamlShows how a bench joins the shared proxy network and keeps private networks separate
overrides/compose.multi-bench-ssl.yamlShows the per-bench HTTPS router added to shared Traefik
overrides/compose.custom-domain.yamlShows custom host routing through Caddy and the two-network boundary
overrides/compose.custom-domain-ssl.yamlShows HTTPS and certificate resolution for custom-domain routing
resources/core/nginx/nginx-template.confExplains the frontend's public-facing role and its handoff to backend and WebSocket services