Skip to content

Access lists & mTLS

This page covers two ways to guard a host without a login page. For the login-page version, see forward auth.

Access listsPick a list to see its members and the hosts it protects - Board preview has none.Nothing you change here is saved
  • unused
  • empty
4 lists, 6 members
StagingEverything not meant for the public yet
UsernameAddedActions
avery04/01/2026
sam04/01/2026
priya22/01/2026

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.

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.

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/56 for a whole /56, home.example.com/128 for 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.

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.

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.

An access list's Network tabReorder, add or remove rules, set an expiry or a deny response and save; nothing leaves the page.Nothing you change here is saved
Allow or deny by the client's IP address. Rules are checked top to bottom and the first match decides. The address is taken after Settings > Network > Trusted proxies applies, so a CDN or load balancer in front does not hide the client. A hostname, such as a dynamic-DNS name, is looked up again when its record expires and matches every address it resolves to: an IPv4 address exactly, an IPv6 address with its /64 (end the name in /56, /128 and so on to change that).A rule can also match the client's country, continent or network (ASN), looked up in the GeoIP databases. Mixed with address rules, the first match still decides. Each rule can carry a note and an expiry; an expired rule stops applying at once and is removed within a minute.
Resolves to 2001:db8:4f2:1a00::/64, 203.0.113.24/32
Only used while there is at least one rule.
Refuse a request when its client cannot be distinguished from a trusted proxy, for example one that arrives through a proxy without X-Forwarded-For. This check runs before any rule or password. Needs the Geo Blocking module and trusted proxies to be set.

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.
Plain text or HTML, sent as written, up to 8192 characters. Empty sends "Access denied".

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.

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.

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.

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.

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.

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.

Adding an account to an access listGenerate, reveal and copy all work.Nothing you change here is saved
At least 12 characters, including upper and lower case, a number, and a special character

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.

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.

mTLS on a proxy hostTrust by role, or pick certificates one at a time.Nothing you change here is saved
Mutual TLS (mTLS)Require clients to present a trusted certificate to connect
mTLS requires TLS on this host
A certificate must be set. Select roles and/or individual certificates to allow.
Leave empty to require an identity for the whole host. Comma-separated paths gate only those routes.
Paths that bypass client certificate checks. Every other path stays protected. Ignored if Protected paths is set.
Trusted roles
  • opsReaches /admin/*1 cert
  • staff1 cert
Trusted certificates
0/2
Certificates issued by Internal CA
  • avery@laptopexpires Jan 4, 2027
  • backup-runnerexpires Jan 4, 2027