Access lists & mTLS
This page covers two ways to guard a host without a login page. For the login-page version, see forward auth.
- unused
- empty
| Username | Added | Actions |
|---|---|---|
| avery | 04/01/2026 | |
| sam | 04/01/2026 | |
| priya | 22/01/2026 |
Access lists
Section titled “Access lists”Multi-account HTTP basic auth, assignable per proxy host. Passwords are bcrypt-hashed. One list can protect several hosts, and adding an account to the list grants it everywhere the list is used.
An empty list fails closed. A host whose list has no users and no IP rules refuses every request rather than serving it unauthenticated. The access lists page flags an empty list, and warns when a host is still using one; the host editor marks empty lists in its picker and warns when one is chosen.
IP rules
Section titled “IP rules”A list’s Network tab holds allow and deny rules on the client: single IPs, CIDR ranges or hostnames, IPv4 or IPv6, and countries, continents or networks (below). Rules are checked from the top, and the first one that matches decides. When no rule matches sets what everyone else gets; it defaults to deny, so a list of allow rules is an allowlist. The address is the one Caddy resolves after trusted proxies, so a CDN or load balancer in front is seen through rather than allowed or denied as a whole.
The same rules can guard an L4 host, where only they apply, since a list’s users, passwords and deny response mean nothing below HTTP. Country, continent and ASN rules apply there too, through the blocker module’s layer 4 matcher. Either way the rules see only the address that reaches Caddy: with Docker’s userland proxy in the path, some setups show every client as the bridge gateway, which the L4 page explains.
Hostnames
Section titled “Hostnames”A rule can name a host instead of an address, such as a dynamic-DNS name for someone’s home connection. Caddy’s IP matchers only take ranges, so the controller does the lookup: it resolves A and AAAA records, writes the answer into the config, and looks the name up again whenever the record’s TTL runs out (clamped to between a minute and an hour), reloading Caddy only when the answer changed. A name is looked up as soon as it is saved, and the Network tab shows what each one currently stands for, or why it stands for nothing.
- IPv4 answers are exact; IPv6 answers cover their /64. A home connection’s IPv6 address moves
around inside its /64 as privacy addresses rotate, so one address would stop matching within
hours. End the name in a prefix length to change that:
home.example.com/56for a whole /56,home.example.com/128for the exact address. Anything wider than /48 is refused. - A failed lookup keeps the last answer for 24 hours, retried every minute. After that, and for a name that has never resolved, the name stands for no addresses at all.
- No addresses fails closed for allow, and open for deny. An allow rule with nothing behind it admits nobody; a deny rule with nothing behind it denies nobody, and the Network tab warns about it. A list whose only rule is an unresolved allow shuts everyone out, on an L4 host too.
- A name counts as one rule towards a list’s limit of 500, and stands for at most 16 addresses. Lookups go to the servers under Settings → DNS → DNS resolvers when those are enabled, and to the controller’s own resolver otherwise, so a name that only resolves inside a network needs a controller that can see that network’s DNS.
Countries, continents and networks
Section titled “Countries, continents and networks”A rule can also match where the client is: a country (DE), a continent (EU) or a
provider network by its ASN (AS13335), looked up in the GeoIP databases from
GeoIP settings. They mix freely with address and hostname rules and keep the
same order, so “deny 192.0.2.7, allow PT, deny EU” lets Portugal in except that one address,
and refuses the rest of Europe. They need the Geo Blocking module; without it they are skipped
(an allow of this kind admits nobody, a deny denies nobody), and the Network tab and Needs
attention both say so.
A list with one of these rules is decided by the blocker module rather than Caddy’s own IP
matcher. It reads the client from X-Forwarded-For behind the same trusted proxies as geo
blocking, and a client it cannot place counts as matching no rule.
Notes and expiry
Section titled “Notes and expiry”Every rule takes a note, and an optional expiry: in an hour, a day, a week or a month. Past it the rule stops applying at once and is deleted within a minute, recorded in the audit log. Use it for a contractor’s address or a team that is travelling.
Deny response
The response to a request the rules refuse. With Satisfy set to Any, a refused visitor is asked for a password instead. On a list with a country, continent or ASN rule, a visitor who sends credentials is judged on the password alone.A list can hold IP rules alone, users alone, or both. With both, Satisfy decides how they combine:
- All (the default): the address has to be allowed and the password right.
- Any: an allowed address gets straight in, and everyone else, a denied address included, is asked for the password. The office network walks in; working from home means logging in.
With Any and a country, continent or ASN rule, a visitor who sends credentials is checked on them alone, and everyone else on the rules; a refused visitor is asked for the password.
Deny response and failing closed
Section titled “Deny response and failing closed”By default a refused request gets 403 Access denied. The Network tab’s Deny response sets a
status from 400 to 599 with a body of your own (sent as written, up to 8 KiB), or a 302 redirect
to an absolute URL, such as a page explaining how to get access.
Fail closed refuses a request whose client cannot be told apart from a trusted proxy (one that
arrives through your load balancer without an X-Forwarded-For, for instance) before any rule or
password is checked. It needs the Geo Blocking module and trusted proxies to be set.
What a list did
Section titled “What a list did”The Usage tab counts the hosts using the list and, with analytics on, the requests it stopped and the failed sign-ins (401s) over the last 24 hours, counted on the hosts using it. A host whose location rules use another list counts towards both.
Per-path lists
Section titled “Per-path lists”A location rule can use a list of its own instead of the host’s,
or none at all: keep /admin/* to a stricter list, or leave /.well-known/* open on an otherwise
protected host.
Deleting a list
Section titled “Deleting a list”A list a host still uses cannot be deleted, whether the host itself, a location rule on it, an L4 host or the dashboard host uses it. The page names the hosts, and the REST API answers 409. Choose another list on them first, so nothing that was protected quietly stops being so.
Passing the password on
Section titled “Passing the password on”By default the upstream never sees the credentials a list checked: CPM removes the Authorization
header before forwarding the request. Turn on Pass auth to host for an application that reads
the username from it itself. Lists made before this setting existed have it on, which is how they
always behaved.
Access lists are simple, and fit the cases basic auth fits: an internal tool, a staging site, something you want off the open internet without standing up an identity provider.
Mutual TLS
Section titled “Mutual TLS”mTLS asks the client for a certificate. A visitor without one does not get a connection at all, which is a stronger boundary than any password: there is nothing to phish and nothing to guess.
CPM includes a CA for this. Issue client certificates from the Certificates page, hand them to the people or machines that need them, and enable mTLS on the hosts they should reach. The CA’s private key is encrypted at rest like every other secret; Caddy only ever gets the CA certificate.
Revocation is fail-closed. Revoking a certificate rejects it immediately, and revoking every certificate rejects every connection rather than falling open to none-required.
mTLS RBAC
Section titled “mTLS RBAC”Certificates can carry roles, and roles can be given path rules per host. So one certificate reaches
the application while another also reaches /admin/*:
| Path | Requires |
|---|---|
/* |
Any valid client certificate |
/admin/* |
The ops role |
Paths can also be excluded, which is how a health check endpoint or an ACME challenge path stays reachable without a certificate.
Roles are assigned to issued certificates, so revoking one certificate does not disturb the others holding the same role.
- opsReaches /admin/*1 cert
- staff1 cert
- avery@laptopexpires Jan 4, 2027
- backup-runnerexpires Jan 4, 2027