Choose your proxy
Each proxy is a provider. Detection finds the one holding ports 80 and 443 and--provider auto (the default) uses it; you can also pick one explicitly.
In the dashboard, open Network, then Traffic, and use the Proxy card:
- Pick a provider. The detected one is marked.
- Press Dry run to see the files that would be written (managed) or the snippet to add by hand (manual). Dry run changes nothing.
- Press Apply and verify. Levelrail writes the files, validates and reloads the proxy where needed, then probes every domain over HTTPS. Manual providers have no Apply button: add the snippet yourself, then press Re-check.
- Press Re-check any time to read the proxy again. “Fix via CLI” under the buttons shows the matching command.
levelrail-cli proxy setup --provider nginx is a dry
run, add --confirm to apply. proxy status, proxy apply, proxy verify
and proxy disable work for every managed provider.
One step setup (Traefik, including Coolify)
When the proxy is Traefik with a file provider directory, Levelrail can manage the routes itself: one file per domain in the directory Traefik watches, rewritten on every reconcile pass and removed when the domain goes away.setup --confirm and
proxy verify therefore wait (up to APP_PROXY_VERIFY_TIMEOUT, default 8s)
for the router to show up, and a route that is still not loaded is reported as
the pending step “waiting for the proxy to load the route”, not as an error.
Run proxy verify again once Traefik has reloaded.
Setup, in order:
- Detect. It reads the container publishing host port 80 or 443 through the
Docker API (no
dockerCLI): its arguments, mounts, published ports and extra hosts. A mountedtraefik.ymlis read instead of the arguments when Traefik loads one. Nothing is defaulted: anything it cannot determine is listed and setup stops with409and the exact gap. - TLS upstream. It turns on
tls_terminated_upstreamand setspublic_https_portto the host port the proxy publishes for HTTPS. This instance stops requesting certificates and stops redirecting HTTP itself. - Routes. It saves the detected values and writes the route files.
- Verify. For every route it runs a TLS handshake to this server’s public
address with the domain as SNI (issuer and expiry of the certificate the
proxy serves), then a request with the domain as
Host. When Traefik’s API is published without authentication, it also asks Traefik whether the router is loaded.
levelrail-cli proxy disable, which removes the files it wrote and keeps everything else.
What is detected on Coolify
Coolify startscoolify-proxy with:
Each domain gets
/data/coolify/proxy/dynamic/levelrail-managed-<domain>.yaml:
an HTTPS router with the certificate resolver, an HTTP router that redirects to
HTTPS, and a service pointing at the ingress HTTP port (app domains) or the
dashboard listener (the primary domain). Coolify lists these files next to its
own coolify.yaml and default_redirect_503.yaml; leave them to Levelrail.
When the listener is on loopback
The proxy runs in a container, so it can’t reach a listener bound to127.0.0.1. Setup then stops with upstream_unreachable and the exact
drop-in, for example:
systemctl daemon-reload && systemctl restart levelrail. That address is
internal to the host, not reachable from the internet.
Safety model
The control plane writes into a directory another product owns, so it is strict about what it touches:- Only files named
levelrail-managed-*.yamlwhose first line is# managed by levelrail. A file with the prefix but without the header is reported and never overwritten or deleted. - Symlinks are never followed; the directory is resolved once and re-checked before every change, and a directory that resolves outside its parent is refused.
- Writes go to a temporary file in the same directory, then
rename, mode0644, so Traefik never reads a half-written file. - Domains are validated strictly: no wildcards, ports, paths or separators, and a domain that would need rewriting to become a file name is rejected.
- If a route cannot be rendered (for example the upstream became unreachable), the existing file is kept rather than deleted.
- Every write and removal is audited as
proxy_route.writtenandproxy_route.removed. - If the control plane cannot write the directory (another user, a read-only
mount or a systemd sandbox), setup reports
not_writablewith the uid, the owner and mode of the directory, or theReadWritePaths=line to add.
Settings
PUT /api/v1/settings/proxy-integration sets them by hand, for a Traefik whose
directory is not on a host mount detection can see, or with a TOML static file:
levelrail-cli proxy setup --dynamic-dir DIR covers the common case of a
directory detection could not map.
nginx (managed)
For an nginx container that owns ports 80 and 443, Levelrail writes one file per domain and keeps your own nginx configuration untouched.Host and
X-Forwarded-* headers.
Detection reads the container through the Docker API and never guesses. It
lists a gap, and setup stops with the exact text, when:
- neither
/etc/nginx/conf.dnor/etc/nginx/sites-enabledis on a host mount (pass--dynamic-dir); - a readable
nginx.confdoes not include that directory; - nothing is mounted at
/etc/letsencrypt, certbot’s layout, so the certificate paths are unknown (pass--cert-dir, the directory inside the container that holds<domain>/fullchain.pemandprivkey.pem); - container port 80 or 443 is not published, or the way the container reaches this host cannot be read.
# managed by levelrail,
never touching a file without it), with these additions:
- After writing, Levelrail runs
nginx -tand, only when it passes,nginx -s reload, both through the Docker Engine API (nodockerCLI). - If
nginx -tfails, every change is rolled back, nothing is reloaded, and the API, CLI and dashboard report nginx’s own error text. Saved settings andtls_terminated_upstreamare left as they were. - Turning the integration off removes the files and reloads nginx.
When the proxy you chose is not running
Pick Traefik or nginx on Network, Proxy while nothing of that kind holds ports 80 and 443 and the page shows “Traefik is not running on this server yet” with three choices instead of an error:- Install and start Traefik for me. Shows the exact plan first (image,
ports, mounts and the static configuration file), then starts the container
only after you confirm. It uses the Docker Engine API, never the docker CLI.
The container is named with the brand short name prefix, carries a label that
marks it as managed by this control plane, restarts unless stopped and
publishes ports 80 and 443. The route directory and
traefik.ymllive under the data directory (proxy/traefik/). A Let’s Encrypt resolver is written only when public certificates are already enabled. Afterwards detection runs again and the route directory is filled in for you. Running it twice does not create a second container, and a container this control plane did not create is never stopped, removed or reused. - Go back to the built-in Caddy. Switches the provider back. Nothing is deleted.
- It runs somewhere else. Shows the container name, route directory, entrypoints, certificate resolver and upstream host with defaults and inline checks, plus Re-check.
APP_PROXY_TRAEFIK_IMAGE overrides the pinned official image.
POST /api/v1/system/proxy-integration/install with {"provider": "traefik", "confirm": false} returns the plan; with confirm: true it applies it through the
typed fix proxy.install.traefik (audited, root only) and answers 409 with a
code such as port_in_use when it refuses.
From the dashboard
Open Domains, then “Put the dashboard behind your existing proxy”. Enter the domain, check the detected proxy, and copy the configuration. “Check it works” resolves the domain, confirms it points at this server, and requests/healthz over HTTPS.
From the CLI
What it generates
If the proxy runs in a container and the dashboard listens on loopback, the
guide also gives a systemd drop-in that moves the dashboard to that network’s
gateway address. That address is internal to the host, not reachable from the
internet, and a drop-in survives upgrades.
Certificates once a proxy owns TLS
When TLS is terminated by the proxy, the platform reports one certificate state for each domain: the certificate the proxy actually serves (issuer, expiry, “renews automatically”), read from the last route verification. Nothing that this server stored earlier is shown or alerted on:- A stale certificate request failure from an earlier attempt, the “another service answers port 80” guidance and the DNS-01 provider prompt are hidden, and the recorded failure is cleared when you enable proxy mode.
- The internal certificate this server stored before the proxy took over is not
listed under Settings > Certificates, in the security checks or in the
domain doctor, and
cert_expiring,cert_expiryandcert_renewal_stalledalert rules ignore it. GET /api/v1/domainsandGET /api/v1/certificatescarry atls_ownerfield (acme,internal,proxy,custom);levelrail-cli domains certificatesprints it as the OWNER column.
levelrail-cli proxy --verify).
Traffic controls behind a proxy
Maintenance mode, basic auth, the auth gate, the WAF and rate limit, redirects and custom error pages are all applied by the built-in ingress. Behind a proxy they work only when the proxy really hands the domain’s requests to that ingress. A route file being written is not enough: another router on the same proxy (for example a container label left over from Coolify) can win the match and send visitors straight to an old container. Every domain inGET /api/v1/domains (and every entry of enforcement in
GET /api/v1/apps/{name}/environment-domains) carries an enforcement block:
“no” means the platform cannot confirm it, so the dashboard shows the saved
setting as Saved, not enforced with the reason, never as active. The
setting itself is kept and starts working as soon as delivery is proven.
To get a managed Traefik route to
yes, open the proxy page and run
Verify (or levelrail-cli proxy --verify). Verification sends a request
through the proxy that only the built-in ingress answers; when it comes back,
the route is proven. Managed routers are written with a high priority so they
win over label routers for the same host. If verification still fails, look
for another router on the proxy that claims the host with an even higher
priority.
For nginx or Caddy in front, point the site at the ingress HTTP listener as
shown in the generated snippet. The controls then apply, but the platform
cannot verify it and keeps reporting them as not enforced.
Links and the public HTTPS port
When a proxy owns 80 and 443 and forwards to this ingress on its own ports (for example8088 and 8443), the certificate lives on the proxy and clients
reach the proxy on 443. Set Public HTTPS port under Domains > Platform
ingress (or levelrail-cli settings ingress set --public-https-port 443) so
every link the platform builds (automatic URLs, preview URLs, emailed links)
uses the port clients actually use. 443 produces links with no port suffix,
any other value is appended, and 0 keeps the ingress listen port.
Several instances behind one proxy
Each instance can’t own 80 or 443 and must not run ACME. Give every instance its own ingress ports, let one proxy hold 80 and 443, and turn on TLS is terminated by a proxy in front (--tls-terminated-upstream) on each:
https links with the public port (443 when unset),
and does not redirect HTTP itself because the proxy does. Set
APP_INGRESS_TRUSTED_PROXIES to the proxy’s address range so X-Forwarded-Proto
and X-Forwarded-Host are honoured only from it, never from the open internet.
The dashboard shows “HTTPS is handled by your proxy” instead of a certificate
error. DNS for each domain still points at the proxy host.
Traefik, one host rule per domain and one backend port per instance:
APP_INGRESS_HTTP_ADDR=:8088, instance B with
APP_INGRESS_HTTP_ADDR=:8089. Forward to the HTTP port: TLS ends at the proxy.
Troubleshooting
Domains served by the proxy are not routing correctly
Requests to the domain arrive at the proxy but do not reach the right Levelrail app. Likely cause: the proxy’s route rule does not match the Host header, or Levelrail is not listening on the port the proxy is forwarding to. How to confirm: check the proxy configuration (Traefik, nginx, Caddy) and verify it has a route for the domain pointing to the correct Levelrail port (e.g., 8088). Also check that Levelrail is actually listening on that port withsudo ss -tlnp | grep 8088.
Fix: verify Levelrail is running and listening on the correct port (set with APP_INGRESS_HTTP_ADDR or via the installer). Then add or update the proxy’s route to forward the domain to that port. Refer to Example proxy configs above for the correct syntax for your proxy.
The domain shows the proxy’s default certificate
The status line names what the proxy served and, when it can, the reason. The diagnosis code is also returned bylevelrail proxy status and the API. A proxy
fallback certificate (Traefik TRAEFIK DEFAULT CERT, a Caddy local authority, the
nginx localhost certificate or the ingress controller fake certificate) means the
proxy holds no certificate for this host. It is not an expired certificate.
The wait budget is the runtime setting
ingress.proxy_cert_wait (default 5m, seeded
by APP_PROXY_CERT_WAIT, listed by levelrail settings runtime). A change applies on
the next check.
Retry certificate request rewrites the route file twice, about two seconds apart, with a
router priority one higher and then the normal value. Traefik skips a reload whose
parsed configuration is unchanged, so a comment would do nothing; a priority change
reloads it, and Traefik looks again for domains that have no certificate. This is
based on how Traefik handles configuration changes and has not been proven here on a
live host. If the retry changes nothing, restart the proxy container once. It only
works for Traefik file routes. The proxy log is read through the Docker API, and the
line shown has secrets masked.
The dashboard shows mixed HTTP/HTTPS content
The browser blocks some resources because they are loaded over HTTP while the page came over HTTPS. Likely cause: APP_INGRESS_TRUSTED_PROXIES is not set, so Levelrail does not trust theX-Forwarded-Proto header from the proxy and thinks requests are coming over HTTP.
How to confirm: open the browser’s developer console (F12) and check the Network tab for mixed content warnings.
Fix: open Domains, then Platform settings, then “Request limits and trusted proxies”, and press the Fix button. Levelrail reads the forwarding headers of your own request to name the proxy (Cloudflare, Traefik, Coolify or another) and saves its address as the trusted proxy list; “Re-check” confirms it. The CLI equivalent is levelrail-cli settings edge fix. A proxy on a private or loopback address is trusted as private_ranges; a public address is trusted as that one address, and Cloudflare’s public edge is never guessed, so enter its published ranges by hand. To do it by hand instead, set APP_INGRESS_TRUSTED_PROXIES to the IP range or address of your proxy; the environment variable always wins over the saved value. For example, APP_INGRESS_TRUSTED_PROXIES=10.0.0.0/8 for a private network, or the proxy’s specific IP if it is static. After setting it, restart Levelrail: sudo systemctl restart levelrail. Once Levelrail trusts the proxy’s X-Forwarded-Proto header, it will serve links over HTTPS.
The dashboard is unreachable from outside but works on the server
The proxy is not forwarding the dashboard address to Levelrail, or Levelrail is not listening on the right address. Likely cause: the proxy’s configuration does not include the dashboard domain, or Levelrail’s dashboard port (default 8080) is only listening on localhost. How to confirm: check the proxy’s route configuration to see if the dashboard domain is included. Also check Levelrail’s systemd unit withsystemctl cat levelrail and look for APP_HTTP_ADDR (should not be 127.0.0.1 when running behind a proxy).
Fix: add a proxy route for the dashboard domain pointing to Levelrail’s dashboard port (8080 by default, or the port set with APP_HTTP_ADDR or LEVELRAIL_DASHBOARD_PORT during install). Set APP_HTTP_ADDR=127.0.0.1:8080 (local only, since the proxy is the external listener) if it is not already. The installer normally handles this for coexist mode; if you set up the proxy afterward, manually add the route.
Still stuck? Check the Installing behind an existing proxy section or attach your proxy config to an issue on GitHub.
API
GET /api/v1/system/reverse-proxy?domain=D&proxy=traefik&verify=true, or
?app=NAME for an app’s domain.
Managed routes: GET /api/v1/system/proxy-integration (detection, settings,
ingress, per-domain state and the setup checklist), POST .../setup with
{"confirm": true, "provider": "nginx"} (provider is traefik, nginx,
caddy, haproxy or auto; cert_dir and dynamic_dir fill gaps detection
reports; without confirm it is a dry run, and caddy or haproxy answer with
a snippet and manual: true). The GET answer lists the providers and the
selected provider. A proxy that refuses written files answers 409 with code
proxy_rejected and its own error text. Also POST .../apply, POST .../verify?domain=D, and
PUT /api/v1/settings/proxy-integration. Reading needs the read ability,
every write needs root. APP_PROXY_VERIFY_TIMEOUT bounds each probe
(default 8s).
The port and mode above are public_https_port and tls_terminated_upstream on
PUT /api/v1/settings/ingress.
The check only probes a domain that resolves to this server’s own public
address.