Skip to content

HTTPS for the web UI

The pfCentral server listens on plain HTTP, port 2808. It expects a reverse proxy to handle HTTPS. Agents use the same HTTPS address once, to enroll and to download the NATS CA.

  1. Terminate TLS for your public name, for example pf.example.com.
  2. Forward every path to http://<pfcentral>:2808, keeping the Host header.
  3. Not buffer responses. The UI keeps server-sent event streams open for live updates. Buffering makes pages look frozen.
  4. Allow long-lived requests: an idle or read timeout of at least one hour.
  5. Set X-Forwarded-Proto: https. pfCentral uses it to build invite links.

Then set on pfCentral:

PFCENTRAL_SERVER_BASE_URL=https://pf.example.com
PFCENTRAL_TRUSTED_ORIGINS=https://pf.example.com
# PFCENTRAL_COOKIE_SECURE stays at its default, true
Caddyfile
pf.example.com {
reverse_proxy 127.0.0.1:2808 {
flush_interval -1
}
}

Caddy gets and renews a public certificate automatically. For an internal CA, add tls /path/cert.pem /path/key.pem.

These paths answer without a login. Decide who may reach them:

PathNeeded byAdvice
/login, /setup, /invite, /reset, /forgot-passwordPeopleAllow
/enrollAgents, onceAllow from firewalls
/nats-ca.crtAgents, at enrollmentAllow; it is a public certificate
/metricsYour PrometheusRestrict to the scraper
/docs, /openapi.json, /openapi.yamlAPI usersRestrict to your network if you prefer
Terminal window
curl -sI https://pf.example.com/login | head -1 # HTTP/2 200
curl -sI https://pf.example.com/ | grep -i location # location: /login

Sign in. If the sign-in page reloads with no error, the cookie or origin settings are wrong: see Troubleshooting.