Caddy is an
extensible,
cross-platform
Within 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 platform, computing platforms. Some ...
,
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, co ...
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 for deploying long-running services ("apps") using a single, unified configuration that can be updated on-line with a
REST
REST (Representational State Transfer) is a software architectural style that was created to describe the design and guide the development of the architecture for the World Wide Web. REST defines a set of constraints for how the architecture of ...
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
. Official Caddy distributions ship with a set of standard modules which include
HTTP
HTTP (Hypertext Transfer Protocol) 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, wher ...
server,
TLS automation, and
PKI apps.
It is best known for its automatic HTTPS features.
Architecture
Caddy is organized into three main components: a
command
Command may refer to:
Computing
* Command (computing), a statement in a computer language
* command (Unix), a Unix command
* COMMAND.COM, the default operating system shell and command-line interpreter for DOS
* Command key, a modifier key on A ...
, the core
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
, and configuration modules.
The command is the extensible interface by which the
program is executed; it can also load
configuration file
A configuration file, a.k.a. config file, is a computer file, file that stores computer data, data used to configure a software system such as an application software, application, a server (computing), server or an operating system.
Some applic ...
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 by 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
Web standards are the formal, non-proprietary standards and other technical specifications that define and describe aspects of the World Wide Web. In recent years, the term has been more frequently associated with the trend of endorsing a set of st ...
, 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 interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
can be used to load configuration files. Config adapters may be used to convert other configuration formats to
JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
. Existing adapters include the Caddyfile, which has first-class support in the command line; and
YAML
YAML ( ) 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 Extensible Marku ...
,
TOML
Tom's Obvious, Minimal Language (TOML, originally ''Tom's Own Markup Language'') 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 it is designed to map u ...
,
Nginx
(pronounced "engine x" , stylized as NGINX or nginx) 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 Russian developer Igor Sysoev and publicly released in 20 ...
, 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
An ASP.NET HTTP handler is a process that runs in response to a request made to an ASP.NET Web application. The most common handler is the ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed ...
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 the
xcaddy
command line tool, or by manually compiling a custom build.
HTTP server
The 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 program 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 imple ...
and exposed through configuration parameters:
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 assigned to a device connected to a computer network that uses the Internet Protocol for communication. IP addresses serve two main functions: network interface i ...
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.
Development
Caddy version 2 was released on May 5, 2020.
Reviewers say that it still has a simpler configuration file syntax than the
Apache Web Server
The Apache HTTP Server ( ) is a free and open-source cross-platform web server, released under the terms of Apache License 2.0. It is developed and maintained by a community of developers under the auspices of the Apache Software Foundation.
...
, although version 2's configuration format is largely incompatible with the previous major release of Caddy.
Derivatives
-
CoreDNS
The Cloud Native Computing Foundation (CNCF) is a subsidiary of the Linux Foundation founded in 2015 to support cloud-native computing.
History
It was announced alongside Kubernetes 1.0, an open source container cluster manager, which was contri ...
, a project of the
Cloud Native Computing Foundation
The Cloud Native Computing Foundation (CNCF) is a subsidiary of the Linux Foundation founded in 2015 to support cloud-native computing.
History
It was announced alongside Kubernetes 1.0, an open source container cluster manager, which was contri ...
.
References
External links
*{{Official website
Cross-platform free software
Free proxy servers
Free web server software
Reverse proxy
Free software programmed in Go