caddyserver / caddy
Caddy makes HTTPS ordinary, then asks you to understand the automation
A short Caddyfile can front a serious service, but the repository is more than friendly syntax. It is a modular web server with a native JSON configuration, an admin API, certificate automation, and graceful runtime changes.
WHAT TO KNOW FIRST
- Automatic HTTPS coordinates certificates, renewal, redirects, and server configuration, but it still depends on DNS, reachable challenge paths, issuer policy, and durable storage.
- The Caddyfile is a human-friendly adapter into Caddy's native JSON model. The admin API can apply configuration gracefully and must be treated as a privileged control surface.
- Caddy is Apache-2.0, while optional modules, custom builds, service terms, and trademarks remain separate review items.
01The small configuration is backed by a real server
Caddy is an extensible web server written in Go. Its common jobs include serving files, terminating TLS, redirecting HTTP, and reverse-proxying requests to applications. It supports modern HTTP versions through its implementation and dependencies. The approachable default is valuable because a secure public endpoint can be described without copying a page of low-level TLS directives.
That brevity should not be confused with a toy runtime. Listener addresses, host matching, certificate issuers, upstream health, timeouts, header handling, logging, and process privileges still determine production behavior. Read the expanded configuration and request path before trusting a copied example. Caddy removes repetitive ceremony; it cannot know the security and failure contract of the application behind it.
02Automatic HTTPS is a coordinated lifecycle
When configuration contains a qualifying hostname, Caddy can activate automatic HTTPS. It obtains and renews certificates, configures TLS, and ordinarily creates HTTP-to-HTTPS redirects. Public names commonly use ACME issuers, while local names can use Caddy's local certificate authority. The exact behavior depends on addresses, configuration, and the environment described in the official documentation.
Automation needs working DNS, appropriate ports or DNS challenge credentials, agreement with issuer policy, and persistent storage. Rate limits and failed challenges can turn repeated deployments into an outage. Local CA certificates must be trusted by clients through a controlled process. Test issuance before cutover, monitor renewal, and share storage safely when several instances coordinate certificates. Never treat a newly created certificate as proof that future renewal is operationally owned.
03Caddyfile and JSON serve different readers
Caddy's native configuration is JSON exposed through a documented structure. The Caddyfile is a configuration adapter designed for concise human authoring. Directives are parsed and adapted into native configuration. This makes the Caddyfile an excellent interface for common sites while preserving a more complete model for API-driven systems and advanced modules.
The distinction helps debugging. Use the adaptation command to see what shorthand produced, and validation to catch configuration problems before a reload. Directive order and route grouping can affect behavior, so visual order alone is not always the execution model a newcomer imagines. Keep generated JSON generated if the Caddyfile is authoritative, or choose JSON as the source of truth. Editing both independently creates drift that no reload mechanism can resolve.
- Validate configuration in the same build that will run it.
- Inspect adapted JSON whenever routing or matcher order is surprising.
- Choose one authoritative format and make generated output reproducible.
04The admin API is a privileged deployment interface
Caddy can load configuration through its admin API and apply changes without dropping the process for an ordinary restart. The API supports whole-config loads and more targeted configuration operations. Graceful change is useful for certificate state and active connections, and it allows another control system to treat Caddy as a programmable server rather than rewriting files and sending signals.
Anyone who can reach that interface may be able to change routing, load modules already in the build, expose files, or direct traffic. Keep it on an appropriately protected endpoint, use documented origin and permission controls, and do not publish it casually through the proxy it controls. A deployment pipeline should validate, apply, check health, and retain the previous known-good configuration. Graceful loading prevents some interruption; it does not prove the new upstream or route is correct.
05Reverse proxy defaults need an application contract
The reverse_proxy handler can balance requests across upstreams and supports health checks, retries, transports, header manipulation, and streaming-related behavior. Caddy sets common forwarding headers and guards some spoofing cases according to its documentation. The application must still decide which proxy addresses it trusts, how it constructs external URLs, and whether client identity comes from a header at all.
Timeout and retry choices should follow request semantics. Retrying an idempotent read after a connection failure may be safe; replaying a partially processed payment request may not be. Active health checks add traffic, while passive checks infer failure from requests and need enough volume. WebSockets and long-lived streams add shutdown and load-balancing concerns. Test slow bodies, large uploads, disconnects, and upstream replacement, not only a fast GET returning 200.
06Modules make the binary a supply-chain decision
Caddy's architecture is modular. Standard builds include a maintained set of modules, while xcaddy can produce custom binaries with additional modules. This supports DNS providers, authentication systems, storage backends, and specialized handlers without forcing every feature into the core repository. The active configuration can use only modules compiled into the running binary.
A custom module also brings source, dependencies, maintenance, and licensing into the production artifact. Pin module versions, build reproducibly, generate a software inventory, and test Caddy upgrades against every extension. A community module may not share the core project's review or release cadence. Keep the custom surface narrow and preserve the exact binary used for rollback. The phrase Caddy version is incomplete when two deployments contain different modules.
07Security starts before the first request
Run Caddy with only the filesystem, network, and port privileges it needs. Binding low ports does not require giving an otherwise restricted service broad host access when capabilities or an upstream network layer can solve the requirement. Protect private keys and API credentials in Caddy's storage and environment. A file server route should have an intentional root, and proxy routes should not accidentally expose an internal admin service.
TLS at the edge does not secure an untrusted hop behind the edge. Decide whether upstream traffic needs TLS and identity, especially across hosts or networks. Add security headers only with application knowledge; a copied content-security policy can break a site or create false confidence. Logs can contain paths, query values, addresses, and identifiers, so apply retention and access rules. Keep Caddy patched and follow the project's security reporting channel for vulnerabilities.
08Day-two evidence should include failure
Structured access logs, runtime metrics through appropriate modules, process supervision, and upstream application telemetry should tell one incident story. Monitor certificate expiry and renewal errors, response status, latency, upstream failures, connection pressure, storage health, and reload outcomes. Separate Caddy-generated errors from responses returned by the application so the correct owner receives the alert.
Rehearse an unavailable upstream, invalid new config, issuer outage, full storage volume, and process replacement. Persist certificate and state data across redeployments, but avoid blindly sharing a writable directory in unsupported ways. Read release notes before upgrades and test the compiled module set. If running multiple instances, decide which layer balances them and how configuration and certificate coordination work. A single concise file is not a high-availability architecture by itself.
09License simplicity does not cover every adjacent artifact
The caddyserver/caddy repository is Apache-2.0 licensed, including patent and notice terms described by that license. This is a permissive foundation for use and modification. Optional modules can carry other licenses, and a binary assembled with xcaddy must be reviewed as the combination actually distributed. Hosted certificate authorities, DNS providers, and commercial support remain governed by their own terms.
Caddy's name and marks are also subject to trademark rules separate from copyright permission. For most internal deployments, the practical work is to keep notices and a component inventory, then confirm any redistributed custom build with counsel. The technical decision should remain equally concrete: choose Caddy when its automatic HTTPS and programmable server model simplify a known edge. Avoid adding it behind another proxy unless each layer has a named purpose and failure owner.
A SENSIBLE FIRST HOUR
Start small enough to learn the repo
- Run a pinned official Caddy release locally and serve one static directory over a loopback address before exposing a public hostname.
- Create a Caddyfile that reverse-proxies one test application, adapt it to native JSON, and inspect the result so shorthand never remains mysterious.
- Use a controlled domain to exercise automatic HTTPS, then verify certificate issuer, renewal storage, redirect behavior, and what happens when the upstream application stops.
- Before production, protect the admin endpoint, persist and back up Caddy storage, run without unnecessary host privileges, validate config in CI, and rehearse reload plus rollback.
SOURCE LEDGER
What this review is built on
We use the project repository and first-party documentation. Access, licenses and project direction can change, so recheck the linked source before making a production decision.