Security headers — reverse-proxy reference

Reference nginx and Caddy snippets for security headers when the web UI is served separately from the API.

On this page

nginx#

nginx
# Place inside your server {} block for the web UI.
add_header Content-Security-Policy "default-src 'self'" always;
add_header X-Content-Type-Options  "nosniff" always;
add_header X-Frame-Options         "DENY" always;
add_header Referrer-Policy         "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;

Caddy#

caddy
header {
    Content-Security-Policy "default-src 'self'"
    X-Content-Type-Options  "nosniff"
    X-Frame-Options         "DENY"
    Referrer-Policy         "strict-origin-when-cross-origin"
    Strict-Transport-Security "max-age=63072000; includeSubDomains"
}

Notes#

  • The Content-Security-Policy above is intentionally strict (default-src 'self'). If you embed inline scripts or load fonts/images from a CDN, extend it rather than weakening to unsafe-inline.
  • HSTS max-age=63072000 is two years; browsers will refuse plain HTTP for that domain after the first HTTPS visit.
  • X-Frame-Options: DENY and frame-ancestors 'none' in CSP are equivalent; both are present for older browser compatibility.

Report an inaccuracy (opens a support ticket in the portal; nothing is sent from this page)