Neha Patil (Editor)

Caddy (web server)

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Original author(s)
  
Matthew Holt

Development status
  
Active

Repository
  
github.com/mholt/caddy

Written in
  
Go

Initial release
  
28 April 2015; 21 months ago (2015-04-28)

Stable release
  
0.9.5 / 24 January 2017; 23 days ago (2017-01-24)

Caddy, sometimes clarified as the Caddy web server, is an open source, HTTP/2-enabled web server written in Go. It uses the Go standard library for its HTTP functionality.

Contents

One of Caddy's most notable features is enabling HTTPS by default. It is the first general-purpose web server to do so without requiring extra configuration.

The author, Matt Holt, began developing Caddy in December 2014 and released it in April 2015. In the year following its release, it was downloaded over 20,000 times and received 4,500 stars on GitHub.

Caddy supports a variety of Web technologies and is available as statically-compiled binaries for Windows, Mac, Linux, Android, and BSD operating systems on i386, amd64, and ARM architectures.

Capabilities

A variety of web site technologies can be served by Caddy, which can also act as a reverse proxy and load balancer. Most of Caddy's features are implemented as middleware and exposed through directives in the Caddyfile (a text file used to configure Caddy).

  • HTTP/1.1 (plaintext HTTP) and HTTP/2 (default for HTTPS connections)
  • HTTPS, either automatically enabled and managed, or manually configured
  • TLS 1.2 with temporary support for older protocols
  • SNI
  • OCSP Stapling
  • Virtual hosting (multiple sites on the same port)
  • Native IPv4 and IPv6 support
  • Serve static files (uses sendfile where possible)
  • Graceful restart/reload
  • Reverse proxy (HTTP or WebSockets)
  • Load balancing with health checks
  • FastCGI proxy
  • Templates (similar to Server Side Includes)
  • Markdown rendering
  • CGI via WebSockets
  • Gzip compression
  • Basic access authentication
  • URL rewriting
  • Redirects
  • File browsing
  • Access, error, and process logs
  • Experimental QUIC Support
  • Security

    Caddy is not vulnerable to a number of widespread CVEs including Heartbleed, DROWN, POODLE, and BEAST. In addition, Caddy uses TLS_FALLBACK_SCSV to prevent protocol downgrade attacks.

    On June 2, 2015, version 0.7.1 was released to patch a vulnerability to timing attacks in Caddy's basic authentication middleware.

    With regards to protocols and cipher suites, Caddy uses TLS 1.0-1.2 and prefers ECDHE ECDSA with AES256 GCM SHA384, although a dozen different ciphers are supported. Caddy has also been used by Cloudflare as a platform to serve an experimental TLS 1.3 implementation.

    Traditional privilege de-escalation as performed in C programs is non-trivial in Go programs. In order to bind ports lower than 1024, Caddy must be run as root (not recommended) or given capabilities to bind to low ports using setcap (recommended). However, an alternate method of dropping privileges that involves spawning an unprivileged child process will likely be implemented in a future version.

    Caddy does not automatically enable HTTP Strict Transport Security; it is recommended that users enable HSTS using Caddy's header directive.

    Automatic HTTPS

    Caddy activates HTTPS by default for sites with qualifying domain names (names for which a TLS certificate can be negotiated via the ACME protocol), and redirects HTTP requests to HTTPS. It obtains certificates as needed during startup and keeps them renewed during the lifetime of the server. Let's Encrypt is the default certificate authority, but the user may customize the ACME CA that is used, which is often necessary when testing configurations. As of Q1 2016, Caddy accounted for about 2% of certificates issued by Let's Encrypt.

    An alternate configuration allows Caddy to obtain certificates only as needed during TLS handshakes rather than at startup, a feature dubbed "On-Demand TLS." To enable this feature, the user must specify a maximum number of certificates that can be issued this way. When Caddy receives a request for a hostname for which it does not yet have a certificate, it will negotiate a new certificate via ACME and serve it immediately, while caching the obtained certificate in memory and storing it on disk. This process usually takes a few seconds, and is subject to tight rate limits.

    When serving TLS, Caddy will automatically rotate session ticket keys periodically to help preserve perfect forward secrecy.

    References

    Caddy (web server) Wikipedia