What is ProxyAuth? An authentication gateway, explained from the request up
Was this useful?
0 unique visitors
ProxyAuth is an authentication and access gateway. It sits in front of your applications, terminates TLS, decides whether a request is allowed to go any further, and only then forwards it. The application behind it needs no login page, no session store, no auth library and no framework plugin: it receives an identity that has already been verified.
That holds whatever the application is written in — Rust, Go, PHP, Python, or something inherited that nobody can modify anymore. Securing it stops being an integration project and becomes a few lines of configuration.
This post is the map. Every other article on this blog zooms into one part of it.
Two files, three scopes
Everything ProxyAuth does is driven by two files, and knowing which setting lives where tells you immediately whether changing it needs a restart.
| Scope | File | Reload | Typical content |
|---|---|---|---|
| global | config.json | restart | listeners, secrets, rate limits, database, logging |
| vhost | routes.yml | live | sessions, CSRF, TLS, SMTP, login policy, OIDC, maintenance |
| route | routes.yml | live | access control, caching, compression, headers, filters |
A narrower scope always overrides a broader one. Nine settings that
started life as global-only — session_cookie, tag_csrf_token,
login_redirect_url, logout_redirect_url, login_via_otp,
page_change_password, max_age_session_cookie, cors_origins and
smtp — can be set per vhost, which is what lets one instance serve an
internal tool with TOTP and 30-minute sessions next to a customer portal
with its own mail server and day-long sessions.
The vocabulary
Six words are used consistently throughout the documentation and this blog:
- vhost — a hostname, or set of hostnames, that a group of routes answers to. The unit of multi-tenancy: certificate, session policy, CSRF, SMTP and login rules are all scoped here.
- route — a
prefixorregex, plus exactly one content source: a proxiedtarget(orbackends) or astaticpath on disk. - backend — whatever sits behind a proxied route.
- token — the credential issued at login, carried as a bearer token
or as a
session_tokencookie. - middleware — anything applied between matching and forwarding: access control, CSRF, filters, compression, tag substitution, headers.
- relying party — OIDC terminology for a backend that receives an
id_tokenfrom ProxyAuth acting as a provider.
A minimal instance
{
"secret": "a-random-value-of-at-least-64-characters-generated-not-typed",
"token_expiry_seconds": 3600,
"host": ["0.0.0.0", "::"],
"port": 443,
"tls": true,
"session_cookie": true,
"csrf_token": true,
"letsencrypt": { "contact_email": "ops@example.com" },
"users": [
{ "username": "alice", "password": "changeme", "groups": ["staff"] }
]
}
vhosts:
- vhost: ["tool.example.com"]
vhost_cert:
cert: "/etc/proxyauth/cert/tool.example.com/fullchain.pem"
key: "/etc/proxyauth/cert/tool.example.com/privkey.pem"
certbot_renew: true
allow_groups: ["staff"]
login_redirect_url: "/app"
routes:
- prefix: "/"
static: "/var/www/login/"
static_index: "login.html"
tag_proxyauth: true
cache: false
- prefix: "/app"
target: "http://127.0.0.1:8000"
required_login: true
forward_proxy_headers: true
The plaintext password is replaced by its Argon2id hash in place on
first startup. certbot_renew: true makes ProxyAuth obtain and renew a
Let’s Encrypt certificate by itself, binding port 80 for the challenge.
allow_groups is not decoration: a vhost that names nobody accepts no
login at all.
What a request goes through
The order checks run in is part of the contract, because it tells you what each mechanism can and cannot protect:
request
→ IP abuse blocklists (403, never reaches routing)
→ ACME challenge path (served, never gated)
→ route matching (404 if nothing matches)
→ redirect_protect (maintenance response)
→ rate limit (429)
→ required_login (redirect to login)
→ CSRF, access control, filters
→ backend or static file
→ response middleware (tags, hidden blocks, headers, compression)
Two consequences worth remembering: a blocklisted address never reaches anything that could be used to bypass the block, and a vhost in maintenance mode keeps renewing its certificate. The request lifecycle post walks through each gate.
What the backend receives
On a route with required_login, the backend is handed an identity,
never a credential:
X-User: alice
X-User-Roles: admin,ops
X-User-Groups: engineering
Client-supplied copies of these headers are always stripped before
forwarding, so a caller cannot pre-set X-User to impersonate someone.
The token itself stays between the client and ProxyAuth. With
forward_proxy_headers: true, the backend also gets Host,
X-Forwarded-Host, X-Forwarded-Proto, X-Real-IP and
X-Forwarded-For, computed from the resolved client address rather than
copied from the request.
Two directions of identity
ProxyAuth can hold identity in two opposite ways, per vhost:
- Gateway mode (the default). ProxyAuth authenticates the visitor at
POST /auth, issues a session cookie or a bearer token, enforces access, and tells the backend who the visitor is through headers. - OIDC provider mode (
oidc:on the vhost). The backend — Grafana, Nextcloud, GitLab — is a relying party. ProxyAuth serves six OIDC endpoints and hands it a signedid_token; the backend owns its sessions and permissions, and ProxyAuth’s own route-level enforcement steps aside.
A vhost does one or the other, never both.
Operating it
The install script compiles ProxyAuth from a checksummed source crate
on your own machine, creates an unprivileged proxyauth account with no
shell and no home, and installs a service unit that keeps only
CAP_NET_BIND_SERVICE with NoNewPrivileges. After that, the tooling
is part of the binary:
proxyauth quickstart vhost # guided first vhost, previewed before writing
proxyauth routes-audit # what secures each route
proxyauth check-access --username alice
proxyauth certbot check all
proxyauth stats # live counters over a Unix socket
routes-audit and check-access call the same decision function the
proxy enforces at request time, so they cannot drift from reality.
Where to go next
- Your first vhost and account, guided: proxyauth quickstart
- How a login actually runs: /auth, end to end
- Who may log in versus what they may reach: users and access control
- Why a token is tied to its build: the binary is part of the secret
- Running several nodes: Redis revocation sync and sync groups
Two files, three scopes, one ordered chain of gates, and an application that only ever sees a verified identity. Everything else on this blog is a closer look at one link of that chain.