Product Introduction
- Definition: Caddy is an open-source, Go-based web server and reverse proxy software. It operates as a single, statically-linked binary, functioning as a platform for deploying and managing websites and applications.
- Core Value Proposition: Caddy exists to automate and simplify the deployment of secure, production-ready web services. Its primary value is providing automatic HTTPS by default, eliminating the manual complexity of TLS certificate provisioning, renewal, and management, making secure web hosting accessible to developers and sysadmins of all skill levels.
Main Features
- Automatic HTTPS & Advanced TLS Management: Caddy automatically obtains, installs, and renews TLS certificates from Let's Encrypt or other ACME-compliant Certificate Authorities for any configured domain. It implements On-Demand TLS, a unique feature that dynamically provisions certificates during the TLS handshake for custom domains (e.g., in SaaS platforms). It also includes a full Public Key Infrastructure (PKI) suite for creating and managing private Certificate Authorities (CAs), enabling HTTPS for internal networks and localhost with locally-trusted certificates.
- Unified Configuration API & Adaptable Config: Caddy's native configuration is a JSON document managed via a RESTful admin API (
localhost:2019) that offers ACID guarantees for safe, online config changes. It supports config adapters, allowing users to write configuration in other formats like the human-friendly Caddyfile, YAML, TOML, or even NGINX config files, which Caddy then converts to its native JSON. - Extensible Modular Architecture: Nearly every functional component in Caddy is a pluggable module. This includes HTTP handlers (like
file_server,reverse_proxy), TLS certificate issuers, storage backends, and config adapters. This design allows for a lean, custom binary where features are compiled in as needed, ensuring high performance and maintainability. Notable modules include FrankenPHP for running PHP applications as a built-in app server and dynamic backend discovery via DNS (SRV records). - Production-Grade Reverse Proxy and File Server: The
reverse_proxydirective supports HTTP/1.1, HTTP/2, HTTP/3, WebSocket, and FastCGI (e.g., PHP-FPM) backends. It includes features like load balancing (with policies likeleast_conn), active/passive health checks, circuit breaking, retries, and header manipulation. Thefile_serveris a robust static file handler supporting features like brotli and zstd (Zstandard) compression, pre-compressed file serving, virtual filesystems (embedded, SQLite, cloud), byte-range requests, and clean directory listings.
Problems Solved
- Pain Point: The manual, error-prone process of configuring, obtaining, and renewing TLS/SSL certificates for websites, which is critical for security but often a barrier to HTTPS adoption.
- Target Audience: DevOps engineers and SREs managing large-scale, dynamic infrastructures; SaaS developers needing white-label HTTPS for customer domains; Full-stack and backend developers seeking a simple, secure local development environment and deployment tool; System administrators looking for a reliable, secure, and easy-to-configure alternative to NGINX or Apache.
- Use Cases: SaaS Platform Hosting: Using On-Demand TLS to provide automatic HTTPS for thousands of customer custom domains. Internal Service Mesh: Deploying Caddy as an internal reverse proxy and API gateway with a private PKI for mutual TLS (mTLS). Static Site Deployment: Serving JAMstack sites (e.g., Hugo, Gatsby) with automatic HTTPS, compression, and clean URLs. Local Development: Providing HTTPS for
localhostand local project domains with browser-trusted certificates without manual setup.
Unique Advantages
- Differentiation: Unlike NGINX or Apache, which require external tools (Certbot) and manual configuration for HTTPS, Caddy has TLS automation built into its core. It is configured with a simpler, more concise syntax (Caddyfile) and offers a dynamic configuration API, whereas competitors typically require editing static files and sending reload signals.
- Key Innovation: The On-Demand TLS feature is a groundbreaking innovation for multi-tenant hosting. It allows Caddy to provision certificates dynamically only when a new domain is accessed, making it massively scalable and ideal for platforms with thousands or millions of unique domains, a scenario where traditional certificate management tools fail.
Frequently Asked Questions (FAQ)
- How does Caddy get SSL certificates for localhost? Caddy generates its own internal Root Certificate Authority (CA) and uses it to issue short-lived certificates for localhost and internal IP addresses. During the first run, it can optionally install this root CA into your local system's trust store, making the certificates trusted by your browser.
- Is Caddy faster or better than NGINX? Performance is comparable for most workloads. Caddy's primary advantage is not raw speed but developer experience and security automation. It reduces operational overhead by automating TLS and offering simpler configuration, which can lead to fewer errors and faster deployment cycles compared to manually managing NGINX with external ACME clients.
- Can Caddy be used as a load balancer? Yes, Caddy's
reverse_proxydirective includes built-in load balancing capabilities. It supports multiple policies (like round-robin, least connections, first, random, IP hash) and can be combined with active health checks and circuit breaking to create a robust load balancing layer. - How do I run a PHP application with Caddy? You have two primary options: 1) Use the
php_fastcgidirective to proxy requests to an external PHP-FPM process, similar to NGINX. 2) Use the FrankenPHP module, which embeds a PHP runtime directly into the Caddy binary, acting as an application server that typically delivers 4x faster PHP response times than traditional FastCGI setups, without needing a separate PHP installation. - Is Caddy compliant with security standards like PCI DSS? Yes, Caddy's default TLS configuration uses secure, modern ciphers and protocols (like TLS 1.2/1.3) that meet or exceed the requirements for PCI DSS, HIPAA, and NIST compliance without requiring additional manual tuning.