概述
Caddy 本质上是一个配置管理系统,可以运行各种应用程序,如 HTTP 服务器、TLS 证书管理器、PKI 设施等。它可以通过称为配置模块的插件进行扩展。
Caddy 拥有灵活而强大的 HTTP 反向代理、在线配置 API 和健壮的生产级静态文件服务器,默认情况下通过自动 TLS 证书为所有站点提供 HTTPS 服务。
整体程序技术规格
编程语言
内存安全保证
运行时依赖
编译时间
~2 秒热构建
部署环境
- 命令行界面
- 系统服务
- 容器
- Kubernetes
- 嵌入式
供应链和发布
操作系统
- Linux
- Windows
- macOS
- FreeBSD
- OpenBSD
- NetBSD
- Android
微架构
- x86 (i386, i686)
- x86-64 (AMD64)
- ARM
- ARM 64 (AArch64)
- MIPS
- MIPS64[LE]
- PPC64[LE]
- RISCV64
- S390X
- Apple Silicon (Apple ARM; M1, M2 等)
并发模型
插件模型
高级功能
配置更改
- RESTful HTTP API
- 配置文件
- 安全远程访问
应用模块
- HTTP
- TLS
- PKI
- 事件
- 原始 TCP 和 UDP
- SSH
- PHP
- 动态 DNS
- 安全
- 进程监控
- 性能分析
日志
- 分级
- 结构化
- 高效,零分配
- 可扩展
- 删除、过滤、编辑和审查字段
- IP 掩码
- 哈希值
- 正则表达式替换
存储
- 文件系统
- 嵌入式(内存中)
- Postgres
- Redis
- Vault
- Consul
命令行界面
Caddy 的 CLI 不仅有用—它还很有帮助。虽然大多数服务器 CLI 只是运行进程和重载配置,但 Caddy 的 CLI 更进一步,帮助您轻松管理现代 Web 服务器。
插件可以注册自己的子命令来扩展 Caddy 的 CLI。
命令帮助
caddy help
或 -h
访问整体命令帮助或子命令帮助。
man
页面)
管理 API 包装器
- 将配置转换为 JSON
- 启动服务器,可选择使用配置
- 优雅重载配置
- 停止服务器
二进制工具
- 详细的构建元数据
- 列出已安装的配置模块
- 列出依赖项
- 添加和删除插件包
- 打印版本
- 升级 Caddy 二进制文件
配置工具
- 格式化 Caddyfile
- 验证配置
- 列出依赖项
- 添加和删除插件包
- 打印版本
模块工具
- 静态文件服务器
- HTTP 反向代理
- 静态 HTTP 响应(可模板化)
- 存储导入/导出(备份/恢复)
- 为 HTTP 基本认证生成密码哈希
- 导出文件浏览模板
集成工具
- 生成 shell 补全脚本
- 打印环境
- 生成
man
页面 - 将 Caddy 管理的根 CA 安装到信任存储中
- 从信任存储中删除 Caddy 管理的根 CA
退出代码
配置
我们设计 Caddy 时,使其配置不仅提供对功能的访问,而且它本身就是一种功能。
不再争论哪种配置文件格式最好:使用您想要的任何格式!Caddy 的配置适配器允许您使用您喜欢的任何配置格式。
原生配置格式
配置适配器
- Caddyfile
- JSON 5
- JSON-C
- NGINX Conf
- YAML
- CUE
- TOML
- HCL
- Dhall
- MySQL
人性化配置
导出
配置 API
Config files
Automatic HTTPS
Our flagship feature, powered by CertMagic. Caddy is the first and only major server that enables HTTPS by default, and automatically procures and renews certificates for all your sites.
Fully-native, integrated auto-HTTPS is far superior to any solution that requires external tooling or cron jobs. Caddy's certificate maintenance is the best in the industry because it is more robust, reliable, and scalable than any other solution. Caddy simplifies your infrastructure instead of complexifying it.
Sure, you can try deploying 100,000 sites with Certbot and a cron job—but if that doesn't fall over by itself, the web server will. Only Caddy is designed to massively scale TLS certificates both horizontally and vertically.
Never manually generate a CSR again. Never click a link in an email to download a certificate. Never (mis)configure your web server to use them. Never miss reminders to renew your certificates, one-by-one, every few months before they expire. You won't even have to think about certificates or TLS.
It's truly automagic.
Compliance
- PCI DSS compliant
- NIST compliant
- HIPAA compliant
- Industry best practices
On-Demand TLS
Certificate issuers
- ACME
- Internal (self-signed)
- Microsoft Active Directory Certificate Services
Certificate managers
- HTTP
- Tailscale
Cluster coordination
- Obtaining & renewing certificates
- Loading existing certificates
- OCSP staples
- Session ticket keys (STEKs)
Redirect HTTP to HTTPS
OCSP
Must-Staple
Revocation handling
Session ticket hardening
Key types
- Ed25519
- ECDSA P256
- ECDSA P384
- RSA 2048
- RSA 4096
Certificate lifetimes
Most ACME clients assume 90-day certificates, or don't expect certificates shorter than 7 days. Caddy can successfully manage certificates with lifetimes on the order of hours and minutes.
Instead of hard-coding a certain age before renewing, Caddy computes the age relative to the lifespan of each certificate, called a Renewal Window Ratio. By default, Caddy renews certificates after 2/3 of their usable lifetime. This ratio works for most validity periods, but can be adjusted.
Intelligent error handling
Built-in throttling
ACME
Caddy's ACME client is best-in-class, with higher reliability and more production experience than any other integrated ACME client available today. Caddy has been using ACME since before the public availability of Let's Encrypt, and Caddy works with any ACME-compatible CA.
Compatibility
- Let's Encrypt
- ZeroSSL
- Google Trust Services
- BuyPass
- DigiCert
- GlobalSign
- SSL.com
- Smallstep
Test endpoints
External account binding
Challenge types
- HTTP-01
- TLS-ALPN-01
- DNS-01
Alternate challenge ports
- HTTP (default 80)
- TLS-ALPN (default 443)
Smart challenge selection
DNS challenge integrations
- ACME-DNS
- AliDNS
- Cloudflare
- DigitalOcean
- DNSPod
- DuckDNS
- DynDNS
- EasyDNS
- Gandi
- GoDaddy
- Google Cloud DNS
- Hetzner
- Linode
- Name.com
- Namecheap
- Namesilo
- Netlify
- OVH
- Porkbun
- PowerDNS
- RFC 2136
- Route 53
- Scaleway
- Vercel
- Vultr
- See all...
Trusted CA certificates
Preferred chains
- Smallest
- CommonName of root
- CommonName of any
Renewal scheduling
- Internal
- ARI
HTTP server
Caddy's HTTP server is one-of-a-kind: powerful, extensible, efficient, and modern.
HTTP versions
- HTTP/1.1
- HTTP/2
- HTTP/2 over cleartext (H2C)
- HTTP/3
HTTPS
Listen interfaces
- TCP
- UDP
- Unix sockets
Listener wrappers
- Redirect HTTP on HTTPS port
- PROXY protocol
- Tailscale
Timeouts
- Read timeout
- Read HTTP header timeout
- Write timeout
- Idle timeout
- TCP keepalive interval
Full duplex communication
- Configurable for HTTP/1
- Default for HTTP/2
Error handling
TLS termination
- TLS 1.2
- TLS 1.3
- Client authentication (TLS mutual auth; mTLS)
- Client auth modes: request, require, verify if given, require and verify
- Cipher suites
- Curves
- ALPN
- Limit protocol versions
- Default SNI
- Fallback SNI
Cross-site security
Access logs
- More useful than Common Log Format (CLF)
- Request headers (except sensitive fields)
- Response headers
- Remote IP
- Latency
Observability
Request handling
Request filters
- Host
- Path
- Method
- Headers
- Protocol
- Remote IP
- Arbitrary CEL expression
- File (existence, size, modify date)
- HTTP route variable
- Logical NOT
- Geolocation
- Remote host
HTTP handlers
Handlers are modules that can be composed together to handle incoming requests precisely the way you want. Handler modules are, like the rest of Caddy, extensible and pluggable. It is not really feasible for us to list all the handlers here.
In practice, handlers are paired with matchers which filter or classify requests based on various properties such as their path, headers, query string, method, and more. This allows you to selectively apply any and all of these handlers to certain requests.
ACME server
Authelia
Authentication
- HTTP Basic authentication
- JWT
- Discord
- Forms
- SAML
Advanced auth
- Form-based
- Local
- Basic
- LDAP
- OpenID Connect
- OAuth 2
- SAML
Cache
- Badger
- Etcd
- NutsDB
- Olric
- Redis
Encode
- Gzip
- Zstandard (zstd)
- Brotli
File server
Go package vanity paths
gRPC-Web bridging
Header manipulation
- Add
- Set (overwrite)
- Delete
- Substring replace
Image filtering
- Crop
- Fit
- Flip
- Resize
- Rotate
- Sharpen
Map
Mercure
Metrics
HTTP/2 server push
Rate limiting
- Local or distributed
- Multiple zones
- Buffer pooling
- Only 1 goroutine
- Configurable O(Kn) memory management
- State persisted through reloads
- Sets Retry-After header
- Optional jitter
- Highly programmable
Request body controls
Reverse proxy
Rewrite requests
- Method
- URI (path, query string)
- Strip path prefix or suffix
- Regular expression support
- Intelligent URL-encoding and forward-slash handling
Static responses
Subrouting
Templates
Tracing
Variables
WebDAV
Reverse proxy
Caddy has the most flexible general-purpose reverse proxy in the world, featuring advanced request and response handling, dynamic routing, health checking, load balancing, circuit breaking, and more.
What makes Caddy's proxy unique is its design. Only the client-facing side of the proxy needs to be HTTP; the transport underlying the roundtrip with the backend can be fulfilled with any protocol!
Moreover, our proxy can be programmed with highly dynamic upstreams. That is, the available upstreams can change during in-flight requests! If no backends are available, Caddy can hold onto the request until one is.
High-level proxy features
Transports
- HTTP
- FastCGI
- NTLM
Load balancing
- Random
- Random Choose-N
- Least connections
- Round robin
- Weighted round robin
- First available
- Remote IP hash
- Client IP hash
- URI hash
- Query hash
- Header hash
- Cookie hash
Circuit breaking
Health checking
- Active
- Passive
Observability
Upstream sources
- Static
- Dynamic: A records
- Dynamic: SRV records
- Dynamic: Multiple sources combined
Retries
Streaming
Trusted proxies
Header manipulation
- Add
- Set (overwrite)
- Delete
- Substring replace
Buffering
- Requests
- Responses
Request rewriting
Response interception
Active health checks
Active health checks assume a backend is down by default until that is confirmed otherwise by a health check.
HTTP request parameters
- Path & query string
- Port
- Headers
Timing
Success criteria
- Response timeout
- HTTP status code
- Regular expression match on body
Failure safety
Passive health checks
Passive health checks assume a backend is up by default until failure criteria are met in the course of proxying requests.
Failure criteria
- Concurrent request limit exceeded
- HTTP Status
- Latency
Failure memory
HTTP transport
This is the default transport module. It crafts a proxied HTTP request to obtain an HTTP response from the backend.
DNS resolvers
TLS
- Custom root CA pool
- Client authentication to backend
- Custom handshake timeout
- Server Name Indicator (SNI)
- Renegotiation level
- Exempt certain ports from TLS
Connection pooling
- HTTP Keep-Alive
- Custom probe interval
- Maximum idle connections (total and per-host)
- Idle connection timeout
Compression
Connection limit
PROXY Protocol
Timeouts
- Connection (dial)
- RFC 6555 fallback
- Reading response headers
- Expect continue
- Read
- Write
Custom buffer sizes
- Read buffers
- Write buffers
HTTP versions
- HTTP/1.1
- HTTP/2
- H2C (HTTP/2 over cleartext)
FastCGI transport
FastCGI is typically used to serve PHP applications via php-fpm. FastCGI responders may require additional information about the script being run such as script name, path relative to root, etc., and Caddy's FastCGI transport takes care of all of that and makes it configurable.
Highly efficient
Path splitting
Resolve root symlink
Environment variables
Timeouts
- Dial (connect)
- Read
- Write
Capture stderr
Static file server
Caddy's file server is the premier way of serving static files for your website.
It's simple: specify a root directory from which to serve the files, then each request path is automatically appended to the root to get the full path of the file to serve.
Kernel acceleration
Virtual file systems
- Local disk
- Embedded assets
- Amazon AWS S3
Precompressed files
- Brotli
- Zstandard
- Gzip
Hide files and folders
Index filenames
Conditional requests
- Etag
- Last-Modified
- If-Match
- If-None-Match
- If-Modified-Since
- If-Unmodified-Since
- If-Range
Range requests
Canonical paths
Pass-thru mode
File browser
Caddy's file server comes alive through its modern file browser that looks attractive on mobile and desktop. It has more features and utility than any other standard HTTP file server!

Folder listings
Day and night themes

- Light mode
- Dark mode
Sort by columns
- File/directory
- Name
- Size
- Date modified
Filter

Layout

- List
- Grid
Responsive design
JSON API
Accept-Encoding: application/json
header will be replied to with a JSON payload for programmatic or scripted access to your file listing.
Customizable listing template
File size visualization

File type icons


Caddy is a living project with a TON of features. This page is not yet a comprehensive list of all the features and benefits provided by Caddy because there's so many to mention. We welcome contributions on GitHub!