Caddy (web Server)
   HOME

TheInfoList



OR:

The Caddy
web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initiate ...
is an
extensible Extensibility is a software engineering and systems design principle that provides for future growth. Extensibility is a measure of the ability to extend a system and the level of effort required to implement the extension. Extensions can be t ...
,
cross-platform In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software r ...
,
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initiate ...
written in Go. The name "Caddy" refers both to a helper for tedious tasks, and a way to organize multiple parts into a simplified system. At its core, Caddy is an extensible
platform Platform may refer to: Technology * Computing platform, a framework on which applications may be run * Platform game, a genre of video games * Car platform, a set of components shared by several vehicle models * Weapons platform, a system or ...
for deploying long-running services ("apps") using a single, unified configuration that can be updated on-line with a
REST Rest or REST may refer to: Relief from activity * Sleep ** Bed rest * Kneeling * Lying (position) * Sitting * Squatting position Structural support * Structural support ** Rest (cue sports) ** Armrest ** Headrest ** Footrest Arts and enter ...
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
. Official Caddy distributions ship with a set of standard modules which include
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, ...
server Server may refer to: Computing *Server (computing), a computer program or a device that provides functionality for other programs or devices, called clients Role * Waiting staff, those who work at a restaurant or a bar attending customers and su ...
, TLS automation, and
PKI PKI may refer to: * Partai Komunis Indonesia, the Communist Party of Indonesia * Peter Kiewit Institute The Peter Kiewit Institute is a facility in Omaha, Nebraska, United States which houses academic programs from the University of Nebraska ...
apps. It is best known for its automatic HTTPS features. Matthew Holt initially began solo development on Caddy in 2014, followed by the first public release in 2015. The software soon became a public collaboration with hundreds of contributors on GitHub. To satisfy requirements from a growing community with a variety of
use case In software and systems engineering, the phrase use case is a polyseme with two senses: # A usage scenario for a piece of software; often used in the plural to suggest situations where a piece of software may be useful. # A potential scenario ...
s, eventually Caddy was completely rewritten from scratch, and a version 2.0 was released on May 4, 2020. Caddy
binaries A binary file is a computer file that is not a text file. The term "binary file" is often used as a term meaning "non-text file". Many binary file formats contain parts that can be interpreted as text; for example, some computer document fil ...
are officially distributed for
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
,
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
,
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
,
BSD The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
, and other
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s on a variety of
architectures Architecture is the art and technique of designing and building, as distinguished from the skills associated with construction. It is both the process and the product of sketching, conceiving, planning, designing, and constructing buildings o ...
including
x86-64 x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging mod ...
,
ARM In human anatomy, the arm refers to the upper limb in common usage, although academically the term specifically means the upper arm between the glenohumeral joint (shoulder joint) and the elbow joint. The distal part of the upper limb between th ...
, MIPS,
S390X Linux on IBM Z or Linux on zSystems is the collective term for the Linux operating system compiled to run on IBM mainframes, especially IBM Z / IBM zSystems and IBM LinuxONE servers. Similar terms which imply the same meaning are ''Linux/390'', ...
, and
PPC64 ppc64 is an identifier commonly used within the Linux, GNU Compiler Collection (GCC) and LLVM open-source software communities to refer to the target computer architecture, architecture for applications optimized for 64-bit big-endian PowerPC an ...
. Official distributions of
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in 32-bit units. Compared to smaller bit widths, 32-bit computers can perform large calculation ...
binaries were discontinued, but Caddy can be
compiled In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
from
source Source may refer to: Research * Historical document * Historical source * Source (intelligence) or sub source, typically a confidential provider of non open-source intelligence * Source (journalism), a person, publication, publishing institute o ...
for
IA-32 IA-32 (short for "Intel Architecture, 32-bit", commonly called i386) is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the 80386 microprocessor in 1985. IA-32 is the first incarnation of ...
architectures. Packages for
Debian Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of D ...
,
CentOS CentOS (, from Community Enterprise Operating System; also known as CentOS Linux) is a Linux distribution that provides a free and open-source community-supported computing platform, functionally compatible with its upstream source, Red Hat En ...
, RedHat, and
Arch Linux Arch Linux () is an independently developed, x86-64 general-purpose Linux distribution that strives to provide the latest stable versions of most software by following a Rolling release, rolling-release model. The default installation is a minim ...
are also maintained, as well as an official Docker image.


Architecture

The architecture of Caddy is organized into three main components: a
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
, the core
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
, and configuration modules. The command is the extensible interface by which the
program Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * Program, a part of planning Arts and entertainment Audio * Progra ...
is executed; it can also load
configuration file In computing, configuration files (commonly known simply as config files) are computer file, files used to configure the Parameter (computer programming), parameters and Initialization (programming), initial settings for some computer programs. T ...
s, run common modes, manage installed plugins, and offer relevant utility functions. The core library has APIs for loading, unloading, and managing configuration; but it does nothing particularly useful on its own. Most of Caddy's functionality is provided b
modules
which are plugins that extend Caddy's configuration structure; for example, the HTTP server is a module. Caddy modules implement various long-running services, web standards, and other useful features. Caddy's input is a JSON configuration document which is received through an open socket via a RESTful HTTP API. In the absence of an HTTP client, Caddy's
command line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
can be used to load configuration files. Config adapters may be used to convert other configuration formats to
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
. Existing adapters include the Caddyfile, which has first-class support in the command line; and
YAML YAML ( and ) (''see '') is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Exte ...
,
TOML TOML is a file format for configuration files. It is intended to be easy to read and write due to obvious semantics which aim to be "minimal", and is designed to map unambiguously to a dictionary. Its specification is open-source, and receives ...
,
NGINX Nginx (pronounced "engine x" ) is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software ...
, and several other formats. When a configuration is received through its administration socket, Caddy decodes the configuration for all the specified modules, and starts running all the app modules. When the app modules are being provisioned, they themselves may load and provision modules that they use. For example, the HTTP server is an app module which uses HTTP handler modules to handle HTTP requests; these handlers might use yet other modules to implement their functionality, and so on. All these modules are provisioned during the config load phase. Plugins are installed by statically compiling them directly into the Caddy binary. Without plugins, Caddy's native configuration structure only has some basic options for administration and logging. All other functionality must be provided by app modules. Official Caddy distributions ship with dozens of standard modules; others can be added from the project's website, using th
xcaddy command line tool
or by manually compiling a custom build.


HTTP server

Th
HTTP server
is an app module that comes standard with official Caddy distributions. It is primarily used as a static file server and load-balancing reverse proxy. While the basis of Caddy's HTTP features use the implementation found in Go's standard library, a variety enhancements and customizations are available as
middleware Middleware is a type of computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue". Middleware makes it easier for software developers to implement co ...
and exposed through configuration parameters: * Access logging *
Authentication Authentication (from ''authentikos'', "real, genuine", from αὐθέντης ''authentes'', "author") is the act of proving an assertion, such as the identity of a computer system user. In contrast with identification, the act of indicati ...
*
Compression Compression may refer to: Physical science *Compression (physics), size reduction due to forces *Compression member, a structural element such as a column *Compressibility, susceptibility to compression * Gas compression *Compression ratio, of a ...
(
Gzip gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
and
Zstandard Zstandard, commonly known by the name of its reference implementation zstd, is a lossless data compression algorithm developed by Yann Collet at Facebook. ''Zstd'' is the reference implementation in C. Version 1 of this implementation was r ...
) or other encodings * Custom error handling * Directory browsing (view file listings in folders) *
FastCGI FastCGI is a binary protocol A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. The protocol defines the rules, s ...
forwarding * Hard-coded HTTP responses * HTTP redirects * HTTP/1.1, HTTP/2, and HTTP/3 (default for
HTTPS Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP). It is used for secure communication over a computer network, and is widely used on the Internet. In HTTPS, the communication protocol is enc ...
) * HTTP/2 server push *
IPv4 Internet Protocol version 4 (IPv4) is the fourth version of the Internet Protocol (IP). It is one of the core protocols of standards-based internetworking methods in the Internet and other packet-switched networks. IPv4 was the first version de ...
and
IPv6 Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP), the communication protocol, communications protocol that provides an identification and location system for computers on networks and routes traffic ...
support *
Markdown Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown is ...
rendering * Network interface customization * Request matchers * Request size limits (headers and body) *
Reverse proxy In computer networks, a reverse proxy is the application that sits in front of back-end applications and forwards client (e.g. browser) requests to those applications. Reverse proxies help increase scalability, performance, resilience and securi ...
with load balancing, health checks, and retries * Static files * Templates (similar to Server-Side Includes) * Timeouts * TLS by default (TLS 1.3, including temporary support for older versions) * URL rewriting * Variables and
maps A map is a symbolic depiction emphasizing relationships between elements of some space, such as objects, regions, or themes. Many maps are static, fixed to paper or some other durable medium, while others are dynamic or interactive. Although ...
* Virtual hosts (multiple sites on same socket) *
WebSocket WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as in 2011. The current API specification allowing web applications ...
s * Zero-downtime, graceful reloads Caddy's HTTP server handles requests according to configured routes in a middleware pattern. Routes are defined in a list, and each route that matches the request is applied to the middleware chain in order. Requests can be matched from a variety of parameters including HTTP method, hostname, remote address, header fields, path, query string, protocol, variable values, file existence,
CEL A cel, short for celluloid, is a transparent sheet on which objects are drawn or painted for traditional, hand-drawn animation. Actual celluloid (consisting of cellulose nitrate and camphor) was used during the first half of the 20th century, bu ...
expressions, and others as given by plugins. Once matched, handler modules are invoked, which may include a file server, a rewrite middleware, the reverse proxy, rate limiting, header manipulation, and template rendering, among other functions. Additionally, routes can be defined to be mutually exclusive to other routes, or terminal which ends the handler chain. By default, TLS is used automatically if any routes have a non-empty host matcher. These are assumed to be site names or
IP address An Internet Protocol address (IP address) is a numerical label such as that is connected to a computer network that uses the Internet Protocol for communication.. Updated by . An IP address serves two main functions: network interface ident ...
es that Caddy is serving, so Caddy will automatically procure and renew certificates for the configured
hostname In computer networking, a hostname (archaically nodename) is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication, such as the World Wide Web. Hos ...
s and IP addresses. When automatic HTTPS is activated in this manner, Caddy will also redirect HTTP requests to their equivalent HTTPS location.


TLS automation

Th
TLS app
comes standard with official Caddy distributions. It acts as a TLS server and is designed for automation. Caddy's TLS defaults are considered safe and modern. In terms of securing private keys, Caddy is not vulnerable to memory safety vulnerabilities such as Heartbleed because it is written in Go. One of the primary purposes of this module is to load TLS certificates into memory so they can be served to complete TLS handshakes. Certificate and key files may be loaded manually into the server, but they are usually automated by specifying subject names. If loaded manually, Caddy does not auto-renew them. If automated, this app will automatically obtain and renew a certificate for each subject name. A given certificate will be automated according to the first matching automation policy for its subject name (typically a
domain name A domain name is a string that identifies a realm of administrative autonomy, authority or control within the Internet. Domain names are often used to identify services provided through the Internet, such as websites, email services and more. As ...
or
IP address An Internet Protocol address (IP address) is a numerical label such as that is connected to a computer network that uses the Internet Protocol for communication.. Updated by . An IP address serves two main functions: network interface ident ...
). An automation policy consists of issuers and various certificate and management options such as key type, where to store the certificate, whether to manage the certificate "on-demand", and
OCSP The Online Certificate Status Protocol (OCSP) is an Internet protocol used for obtaining the revocation status of an X.509 digital certificate. It is described in RFC 6960 and is on the Internet standards track. It was created as an alternative t ...
options. These automation features work for server certificates as well as client certificates.
Wildcard certificate In computer networking, a wildcard certificate is a public key certificate which can be used with multiple subdomain, sub-domains of a domain. The principal use is for securing web sites with HTTPS, but there are also applications in many other ...
s are supported. An issuer is a source for a certificate, and is typically an
ACME Acme is Ancient Greek (ακμή; English transliteration: ''akmē'') for "the peak", "zenith" or "prime". It may refer to: Arts and entertainment * ''Acme'' (album), an album by the Jon Spencer Blues Explosion * Acme and Septimius, a fictional ...
certificate authority In cryptography, a certificate authority or certification authority (CA) is an entity that stores, signs, and issues digital certificates. A digital certificate certifies the ownership of a public key by the named subject of the certificate. This ...
. Caddy fully supports the ACME protocol including the HTTP, TLS-ALPN, and DNS challenges, External Account Binding (EAB), multiple certificate chains, and smart retry heuristics. Caddy can also be its own issuer with its embedded PKI facilities. Multiple issuers may be specified for redundancy; if one fails to offer a certificate, the next will be tried. TLS certificates can be stored in a configurable storage backend, which is by default the local file system. Plugins exist for other kinds of storage backends such as databases. Caddy instances which are configured to use the same storage backend will automatically act as part of a
cluster may refer to: Science and technology Astronomy * Cluster (spacecraft), constellation of four European Space Agency spacecraft * Asteroid cluster, a small asteroid family * Cluster II (spacecraft), a European Space Agency mission to study t ...
and share certificate and OCSP assets, including coordinating the obtaining and renewal of certificates. Typically, certificates are managed at startup when the config is loaded. However, Caddy supports a mode of automation calle
On-Demand TLS
which defers certificate operations until the very moment the certificate is needed, during the TLS handshake. This is suitable for use cases where the site owner does not control the domain names served by the server. In order to be safe from abuse on a public network, the site owner should configure an endpoint that Caddy will query to ask if a certificate may be obtained for the given Server Name Indication (SNI) in the handshake. Caddy implements OCSP stapling by default. All loaded certificates which specify an OCSP responder in the Authority Information Access extension will have their OCSP response stapled, cached, and refreshed automatically as needed. If an OCSP response indicates a status of Revoked for a managed certificate, Caddy will automatically attempt to replace the certificate with a new one. When serving TLS, Caddy will automatically rotate session ticket keys periodically to help preserve perfect forward secrecy. These keys can also be stored in a configurable backend and used by a cluster of instances for improved performance in a distributed fashion.


PKI facilities

Th
PKI app
comes standard with official Caddy distributions. Its primary purpose is to manage certificate authorities (CAs) that can sign certificates. Each CA consists of a root and intermediate key pair, which are persisted to storage. The CA identifier, common name, and key information can be customized in this module's configuration. This app is primarily used by other modules when self-signed certificates are needed.


Financial backing

Until 2016, Caddy operated completely by volunteer effort without any financial support, simply accepting occasional donations from the website. As the community grew and demands on development time and infrastructure increased, it was determined that the project needed to be funded. Light Code Labs, LLC was formed to become the legal entity behind Caddy. With legal legitimacy, the first form of financial support came from a
Mozilla Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, spreads and supports Mozilla products, thereby promoting exclusively free software and open standards, wi ...
Open Source Support (MOSS) program award in 2016. This provided funding for 6 months of development work, and was crucial to Caddy's growth at that stage. Seeking longer-term sustainability, Light Code Labs soon offered two optional products for businesses and professionals: the Engineering Package and Sponsorship, which granted access to developer resources and publicity for customers. With only little success, it was decided that phasing out those products in favor of distributing official binaries intended for commercial use under a proprietary license could increase sustainability by requiring companies to pay for the right to use specially-offered, pre-compiled Caddy binaries that powered their business. This would leave Caddy's source code under the Apache license for anyone to use freely, while still being able to gain some financial backing from able companies as customers. Although more sustainable, this approach was widely viewed with disdain, and was met with confusion and controversy over the next few years. Product offerings were adjusted to clarify terms, gain the respect of the community, and better capture the commercial sector. In 2019, Light Code Labs entered into a partnership with Ardan Studios to design and build an all-new version of Caddy which could be utilized more readily in enterprise environments: Caddy Enterprise. However, on October 3, 2019, the two companies announced plans to instead revert all plans for commercial licenses, which included: * reaffirming that Caddy will continue to be, and always has been, an Apache-licensed open source project, * dropping all proprietary licensing and removing the business use case restrictions from official binaries, * dropping plans for enterprise-only features, * rebranding the new version of Caddy simply as Caddy 2, * and eliminating all other existing business-only products, subscriptions, and services. Ardan Studios would proceed to offer professional training, Caddy development, and enterprise support to businesses, and provided funding for full-time open source development of the Caddy project for almost one year. Shortly before the initial release of Caddy 2, an agreement was signed by Light Code Labs and Ardan Studios for the Caddy project (along wit
CertMagic
Caddy's core TLS automation library) to be acquired by API Layer, GmbH (later Stack Holdings, GmbH). The transfer of ownership was announced later that year in September 2020, along with a two-year development contract. This exchange did not alter the open source status or development cycle of the project. As of 2021, necessary financial support for the Caddy project continues by
sponsorships Sponsoring something (or someone) is the act of supporting an event, activity, person, or organization financially or through the provision of products or services. The individual or group that provides the support, similar to a benefactor, is k ...
through
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous ...
Sponsors, with ZeroSSL (a Stack Holdings company) being the primary, executive sponsor.


Influence

Caddy has been used as the basis for other software projects and commercial services, and its reach extends into academic research and industry discussion. CoreDNS was created by Miek Gieben from a fork of Caddy v1 which was modified to serve DNS instead of HTTPS. It leveraged Caddy's Caddyfile configuration format, plugin architecture, and use of the Go language.
Cloudflare Cloudflare, Inc. is an American content delivery network and DDoS mitigation company, founded in 2009. It primarily acts as a reverse proxy between a website's visitor and the Cloudflare customer's hosting provider. Its headquarters are in San ...
implemented a machine-in-the-middle (MITM) detection service originally based on Caddy using its native MITM detection capabilities. The same company also used Caddy to serve an experimental TLS 1.3 implementation while participating in the formation of the final TLS 1.3 specification.
Let's Encrypt Let's Encrypt is a non-profit certificate authority run by Internet Security Research Group (ISRG) that provides X.509 certificates for Transport Layer Security (TLS) encryption at no charge. It is the world's largest certificate authority, used ...
considers Caddy's implementation of
ACME Acme is Ancient Greek (ακμή; English transliteration: ''akmē'') for "the peak", "zenith" or "prime". It may refer to: Arts and entertainment * ''Acme'' (album), an album by the Jon Spencer Blues Explosion * Acme and Septimius, a fictional ...
to be the gold standard of ACME clients, and Caddy has become a model for similar software to follow. Caddy has participated in a number of academic papers and enabled various Internet research. It has been referenced in relation to: * validating the feasibility of the ACME protocol in production servers, * Internet-scale deployment of
QUIC QUIC (pronounced "quick") is a general-purpose transport layer network protocol initially designed by Jim Roskind at Google, implemented, and deployed in 2012, announced publicly in 2013 as experimentation broadened, and described at an IETF meet ...
, * a test framework for cloud failover mechanisms, * measuring the security harm of TLS cryptography shortcuts, * advocating the case for secure-by-default TLS, * and improving the usability of deploying HTTPS.


References


External links

* *{{GitHub, caddyserver/caddy Cross-platform free software Free proxy servers Free web server software Reverse proxy Free software programmed in Go