TLS & Certificates
This page covers how ProxyAuth terminates TLS, where it expects certificate files, and its automatic hot-reload behavior.
Enabling/disabling TLS
Controlled by config.json's tls field (default true) - see the config.json Reference. When false, ProxyAuth serves plain HTTP; use this only if TLS is terminated upstream (e.g. by a load balancer or another reverse proxy in front of ProxyAuth) and never expose plain HTTP directly to untrusted networks.
Certificate file locations
Fixed, non-configurable paths:
/etc/proxyauth/certs/cert.pem
/etc/proxyauth/certs/key.pem
cert.pem- the certificate chain (PEM format, one or more certificates).key.pem- the private key (PEM format).
There's currently no config.json option to point these elsewhere - if you need a different location, you'll need a symlink or bind-mount to these paths.
If either file is missing or invalid at startup, ProxyAuth fails to start (this is a hard expect() in the TLS setup - a deliberate fail-fast rather than silently serving plain HTTP or a broken TLS listener).
Getting a certificate onto the server
Any standard method works, since ProxyAuth just reads standard PEM files:
- Fully automatic, no external tools — ProxyAuth can obtain and renew a Let's Encrypt certificate for a vhost entirely on its own (
certbot_renew: true). This is the recommended approach for most setups — see the dedicated Automatic Certificate Renewal (ACME) page. - A CA-issued certificate via an external tool (e.g. Let's Encrypt via certbot/acme.sh) - point its output files at the two paths above, or symlink them (see the dedicated section below for the caveats of doing this with certbot specifically). Still fully supported, and reasonable if you're already managing certificates this way for other services on the same host.
- A self-signed certificate, for local testing (this is what the official Docker image generates automatically on build):
openssl req -x509 -newkey rsa:2048 -sha256 -days 365 -nodes \ -keyout /etc/proxyauth/certs/key.pem \ -out /etc/proxyauth/certs/cert.pem \ -subj "/CN=localhost"
Make sure both files are readable by the proxyauth system user (see the Installation Guide).
Per-vhost certificates
The paths above are the server's single global certificate — served for any hostname that doesn't have its own. A route can give one or more of its vhost hostnames a different certificate via vhost_cert, selected via SNI at handshake time:
- vhost: ["app.example.com"]
vhost_cert:
cert: /etc/proxyauth/cert/app.example.com/fullchain.pem
key: /etc/proxyauth/cert/app.example.com/privkey.pem
prefix: "/"
target: "http://127.0.0.1:8000"
Both cert and key are required if either is set — a vhost_cert block missing one is logged as a warning at startup and that hostname falls back to the global certificate instead. Every vhost_cert pair gets its own file watcher, exactly like the global certificate — hot-reloaded the same way, no restart needed. A connection with no SNI at all (a bare IP connection, or a client that doesn't send it) always gets the global certificate, regardless of any vhost_cert entries.
See routes.yml Reference § Virtual hosts for the full field reference.
Using external Let's Encrypt / certbot with automatic renewal
Since ProxyAuth hot-reloads certificates on file change (see below), a certbot-managed certificate can renew itself indefinitely with zero manual intervention and no restart. If you'd rather ProxyAuth manage this itself with no external tool at all, see Automatic Certificate Renewal (ACME) instead — this section is for operators who specifically prefer keeping certificate management external.
Point vhost_cert (or the global cert/key paths) straight at certbot's own /etc/letsencrypt/live/<domain>/fullchain.pem and privkey.pem — no deploy hook, no copying files elsewhere needed. Certbot's live/ directory being a symlink chain into /etc/letsencrypt/archive/<domain>/, re-pointed on every renewal rather than the files being edited in place, used to be a real gotcha for inotify-based watchers (ProxyAuth's hot-reload watcher included) — a watch that resolves straight to the concrete file/inode at setup time can go stale the moment that symlink gets re-pointed to a new archived file, silently never firing again. ProxyAuth's watcher tracks the containing directory rather than the file itself specifically to avoid this — a renewal re-pointing the symlink (or, for ProxyAuth's own ACME renewal, an atomic rename-over) is picked up reliably every time, not just the first.
Hot reload - no restart needed for renewal
ProxyAuth watches both cert.pem and key.pem for filesystem changes (create/modify/remove events) and reloads them without dropping existing connections or requiring a restart:
File change detected on cert.pem or key.pem
|
v
Wait 400ms (debounce - avoids reloading mid-write,
e.g. while a deploy hook is still writing both files)
|
v
Re-read and re-parse both files
|
+- Success --> atomically swap the active certificate;
| new TLS handshakes use it immediately
|
+- Failure --> log a warning, keep serving the OLD
(still-valid-in-memory) certificate
This means a deploy-hook-based certbot renewal (see above), or ProxyAuth's own automatic Let's Encrypt renewal, takes effect automatically — no restart or manual reload needed, and no special care needed about how the new files land at those paths either: a direct overwrite, an atomic rename-over (the common "write to a temp file, then rename it into place" pattern, which is what ProxyAuth's own ACME renewal uses), and a re-pointed symlink further up the chain (Certbot's traditional approach) are all watched correctly and survive repeated renewals — the watcher tracks the containing directory rather than the file itself specifically so that a renewal replacing the file (its underlying inode, not just its content) doesn't silently stop being noticed after the first time.
If the new files are invalid (malformed PEM, mismatched key/cert pair, etc.), the swap is skipped and ProxyAuth keeps using whatever certificate it already had loaded in memory - a bad renewal doesn't take the server down, but it also means you should still monitor for the reload-failure warning in your logs, since you're now running on borrowed time until the underlying cert issue is fixed.
Reload success/failure messages are rate-limited to once per minute per event type, so a flapping filesystem watch (or a renewal process that touches the files several times in a row) doesn't spam your logs.
Protocol support
ProxyAuth advertises both h2 (HTTP/2) and http/1.1 via ALPN - clients negotiate the best one they support; no configuration needed.
See also
- config.json Reference - the
tlstoggle. - routes.yml Reference § Virtual hosts -
vhost,vhost_cert,certbot_renew. - Automatic Certificate Renewal (ACME) - the native Let's Encrypt integration, in full.
- Installation Guide - file ownership/permissions for the
proxyauthuser.
📖 Wiki Home · 💻 Source Code · 🐛 Report an Issue · 📜 License
Found an error or something outdated on this page? Open an issue or submit a PR against the wiki repository.