ProxyAuth / Configuration

target, static, backends: the ways a route actually answers

ProxyAuthRoutingUpdated on 2026-09-18

Every route has exactly one content source. Either it hands the request to something else (target or backends), or it serves a file from disk (static). Everything else on a route only makes sense once you know which of the two you are on.

static: files, no backend

routes:
  - prefix: "/docs"
    static: "/var/www/docs"
    static_index: "index.html"

Whether static is a file or a directory is detected from disk. A single file answers every request under the route — handy for /favicon.ico. A directory resolves the request path beneath it, with static_index for directory-shaped requests.

Once static is set, target, backends, proxy and cert are ignored for that route. Access control still applies — required_login, username/groups/roles, allow_ips/deny_ips — and only GET/HEAD are served.

With a regex route, static_rewrite rewrites the path before it is resolved against static.

The installer adds proxyauth to www-data, so static routes can read files owned by an existing web server without changing permissions. On distributions without that group, create it or adjust.

target: the normal case

routes:
  - prefix: "/app"
    target: "http://127.0.0.1:8080"

Forward, receive, return. The matched prefix is stripped unless preserve_prefix: true. Pooled connections to each backend host are reused, up to max_idle_per_host idle connections (default 50).

backends: several targets

routes:
  - prefix: "/api"
    backends:
      - url: "http://10.0.0.1:8000"
        weight: 2
      - url: "http://10.0.0.2:8000"
        weight: 1
      - url: "http://10.0.9.9:8000"
        weight: -1

Weighted round-robin: weight 2 against 1 means roughly twice the requests. -1 takes a backend out of normal rotation; it only receives traffic when every weighted backend is down.

A request that times out against one backend is retried against the next rather than dropped. The backend that timed out goes on a short cooldown instead of being retried on every following request, which would otherwise produce a thundering herd of doomed attempts against a machine that is genuinely down.

forward_proxy_headers: tell the backend who called

vhosts:
  - vhost: ["app.example.com"]
    forward_proxy_headers: true
HeaderValuenginx equivalent
Hostthe original vhost name$host
X-Forwarded-Hostsame$host
X-Forwarded-Protohttps or http, as received$scheme
X-Real-IP, X-Forwarded-Forthe resolved, trusted client IP$remote_addr

Client-supplied copies of these are always stripped first, whatever the setting. The IP is the one trust_proxy_forward_for resolution produces, never a blind copy. Off by default, so a backend already fed by a load balancer keeps its values until you opt in.

cert: ProxyAuth authenticating itself (mTLS)

routes:
  - prefix: "/secure-api"
    target: "https://internal-service:8443"
    cert:
      file: "/etc/proxyauth/certs/client.crt"
      key: "/etc/proxyauth/certs/client.key"

Outbound mTLS: the backend authenticates ProxyAuth, independently of whatever authenticated the visitor. The identity is an ordinary PEM pair — the certificate chain in file, the unencrypted private key in key (PKCS#8, PKCS#1 or SEC1). The backend’s own certificate is checked against the system trust store, so a private CA has to be installed on the host.

Connections are pooled per target and certificate together. Two routes pointing at the same backend with different certificates never share a connection, so a request can never leave authenticated as the wrong identity.

strict_mtls: what a broken certificate does

{ "strict_mtls": true }
SettingCertificate unreadable or not pairingSuits
false (default)connects without client auth, logs a warningbackends that also accept unauthenticated callers
truethe request fails with 502backends that rely on mTLS to identify ProxyAuth

The default favours availability, and it can hide a problem: a renamed certificate path silently stops authenticating until the backend’s reaction becomes visible somewhere else. If the backend depends on that identity, set strict_mtls: true and let a 502 tell you immediately.

proxy: go through another proxy first

routes:
  - prefix: "/partner"
    target: "https://api.partner.com"
    proxy: true
    proxy_config: "http://egress.internal:3128"

A forward proxy on the outbound leg: a corporate egress, or a fixed egress IP a partner allow-lists. Always set proxy_config explicitly. cert and proxy combine. HEAD behaves the same through either path.

secure_path: pin the backend path

routes:
  - prefix: "/api/endpoint"
    target: "http://localhost:8000/api/endpoint"
    secure_path: true

Every request is forwarded to exactly target, ignoring the sub-path. /api/endpoint/../other still reaches /api/endpoint. Useful for a single-purpose endpoint that should never be traversed.

backend_timeout and streaming

backend_timeout (global, default 10 000 ms) bounds a proxied request. With streaming: true it bounds only the arrival of headers, and the body flows as long as it takes. See the streaming post.

Response-side options

Headers — merged from the vhost group and the route; the route wins per key:

vhosts:
  - vhost: ["example.com"]
    headers:
      Strict-Transport-Security: "max-age=63072000; includeSubDomains"
    routes:
      - prefix: "/admin"
        target: "http://127.0.0.1:8000"
        headers:
          X-Frame-Options: "DENY"

An invalid header name or value is skipped and logged; the rest apply. Rejections that happen before a route matches (blocklist 403, CORS refusal) do not carry route headers.

Compression — gzip, deflate, brotli, negotiated with Accept-Encoding:

compression:
  enabled: true
  algorithm: "br"
  min_size: 1024
  max_size: 10485760
  types: ["text/html", "application/json"]

Every field is optional and inherits from the vhost group, then the global compression block. Never applied to a response the backend already compressed.

Caching — cache: false sends no-store, no-cache, must-revalidate, max-age=0 plus Pragma: no-cache. With cache: true, cache_duration_secs sets max-age (global default 300; 0 gives max-age=0). Use cache: false on anything rendered per visitor.

Request filters

routes:
  - prefix: "/webhook"
    target: "http://127.0.0.1:9000"
    filters:
      default_allow: false
      allow:
        - field: method
          pattern: "^POST$"
        - field: header
          name: "^x-webhook-secret$"
          pattern: "^expected-value$"
        - field: body_json
          key: "event"
          pattern: "^(push|release)$"
  • Every condition in allow must match (AND). Failure is a 403.
  • field is one of method, path, header, query, body_raw, body_json.
  • Every pattern is a regex — "POST" alone matches any method containing it. Anchor.
  • For header and query, name is itself a regex over names. A repeated query parameter is matched across all its values.
  • path is canonicalised first.
  • body_json only parses when Content-Type contains application/json; body_raw never matches non-UTF-8 bodies.
  • default_allow is only read when allow is empty. An empty allow with default_allow: false blocks the route outright.

The body is only read when a condition asks for it.

What never crosses

Ten hop-by-hop headers are stripped both ways, and WebSocket upgrades do not pass through. See the hop-by-hop post.

Static or proxied, never both. On the proxied side: how many backends, what the backend learns about the caller, which identity ProxyAuth presents, which path it may reach — and what the response looks like on the way back.