Caddy 2.4 RC 1 released

In preparation for our first stable release of 2021, version 2.4 RC 1 is now available! It contains over 100 commits with patches, fixes, and features. Please see the change log for more information.

:newspaper: Release notes and :arrow_down: Download

New content for sponsors

If you or your company is sponsoring Caddy, you have access to my new Expert Caddy series of chapters, which goes into depth about Caddy and related topics that will help you make the most of your web server. If you’re not already a sponsor, sign up here:

Thank you for your ongoing support! It will allow me to continue working on Caddy full-time.


For my frontend reverse proxy, I have Caddy built with the Cloudflare plugin. For backend services, Caddy is configured as a web server so the static binaries suffice for those servers. In rolling out Caddy 2.4.0-RC1, I first attempted to upgrade the frontend. These are the steps I took:

Current Caddy version:(running in a FreeBSD 12.2 jail)

root@caddy:/ # caddy version
v2.4.0-beta.2 h1:DUaK4qtL3T0/gAm0fVVkHgcMN04r4zGpfPUZWHRR8QU=

Because of the issue identified in the thread Unable to build the release version of Caddy (with the Cloudflare plugin), I took a copy of the current build in case I needed to do some regression testing later.

cp /usr/local/bin/caddy /usr/local/www/caddy_2.4.0-b2

I then attempted an in situ upgrade to see if the issue identified in Caddy 2.4.0 beta 1 is now available post #17 had been resolved.

This time, Caddy wasn’t downgraded to 2.3.0, but neither was it upgraded to 2.4.0-RC1. There appeared to be no change to the built Caddy version.

root@caddy:/ # caddy upgrade
2021/05/04 00:57:00.894 INFO    this executable will be replaced        {"path": "/usr/local/bin/caddy"}
2021/05/04 00:57:00.895 INFO    found non-standard module       {"id": "dns.providers.cloudflare", "package": ""}
2021/05/04 00:57:00.895 INFO    requesting build        {"os": "freebsd", "arch": "amd64", "packages": [""]}
2021/05/04 00:57:01.772 INFO    build acquired; backing up current executable   {"current_path": "/usr/local/bin/caddy", "backup_path": "/usr/local/bin/caddy.tmp"}
2021/05/04 00:57:01.773 INFO    downloading binary      {"source": "", "destination": "/usr/local/bin/caddy"}
2021/05/04 00:57:14.893 INFO    download successful; displaying new binary details      {"location": "/usr/local/bin/caddy"}

Module versions:

admin.api.load v2.4.0-beta.2
admin.api.metrics v2.4.0-beta.2
caddy.adapters.caddyfile v2.4.0-beta.2
caddy.config_loaders.http v2.4.0-beta.2
caddy.listeners.tls v2.4.0-beta.2
caddy.logging.encoders.console v2.4.0-beta.2
caddy.logging.encoders.filter v2.4.0-beta.2
caddy.logging.encoders.filter.delete v2.4.0-beta.2
caddy.logging.encoders.filter.ip_mask v2.4.0-beta.2
caddy.logging.encoders.filter.replace v2.4.0-beta.2
caddy.logging.encoders.json v2.4.0-beta.2
caddy.logging.encoders.single_field v2.4.0-beta.2
caddy.logging.writers.discard v2.4.0-beta.2
caddy.logging.writers.file v2.4.0-beta.2 v2.4.0-beta.2
caddy.logging.writers.stderr v2.4.0-beta.2
caddy.logging.writers.stdout v2.4.0-beta.2 v2.4.0-beta.2
http v2.4.0-beta.2
http.authentication.hashes.bcrypt v2.4.0-beta.2
http.authentication.hashes.scrypt v2.4.0-beta.2
http.authentication.providers.http_basic v2.4.0-beta.2
http.encoders.gzip v2.4.0-beta.2
http.encoders.zstd v2.4.0-beta.2
http.handlers.acme_server v2.4.0-beta.2
http.handlers.authentication v2.4.0-beta.2
http.handlers.encode v2.4.0-beta.2
http.handlers.error v2.4.0-beta.2
http.handlers.file_server v2.4.0-beta.2
http.handlers.headers v2.4.0-beta.2 v2.4.0-beta.2
http.handlers.metrics v2.4.0-beta.2
http.handlers.push v2.4.0-beta.2
http.handlers.request_body v2.4.0-beta.2
http.handlers.reverse_proxy v2.4.0-beta.2
http.handlers.rewrite v2.4.0-beta.2
http.handlers.static_response v2.4.0-beta.2
http.handlers.subroute v2.4.0-beta.2
http.handlers.templates v2.4.0-beta.2
http.handlers.vars v2.4.0-beta.2
http.matchers.expression v2.4.0-beta.2
http.matchers.file v2.4.0-beta.2
http.matchers.header v2.4.0-beta.2
http.matchers.header_regexp v2.4.0-beta.2 v2.4.0-beta.2
http.matchers.method v2.4.0-beta.2
http.matchers.not v2.4.0-beta.2
http.matchers.path v2.4.0-beta.2
http.matchers.path_regexp v2.4.0-beta.2
http.matchers.protocol v2.4.0-beta.2
http.matchers.query v2.4.0-beta.2
http.matchers.remote_ip v2.4.0-beta.2
http.matchers.vars v2.4.0-beta.2
http.matchers.vars_regexp v2.4.0-beta.2 v2.4.0-beta.2
http.precompressed.gzip v2.4.0-beta.2
http.precompressed.zstd v2.4.0-beta.2
http.reverse_proxy.selection_policies.cookie v2.4.0-beta.2
http.reverse_proxy.selection_policies.first v2.4.0-beta.2
http.reverse_proxy.selection_policies.header v2.4.0-beta.2
http.reverse_proxy.selection_policies.ip_hash v2.4.0-beta.2
http.reverse_proxy.selection_policies.least_conn v2.4.0-beta.2
http.reverse_proxy.selection_policies.random v2.4.0-beta.2
http.reverse_proxy.selection_policies.random_choose v2.4.0-beta.2
http.reverse_proxy.selection_policies.round_robin v2.4.0-beta.2
http.reverse_proxy.selection_policies.uri_hash v2.4.0-beta.2
http.reverse_proxy.transport.fastcgi v2.4.0-beta.2
http.reverse_proxy.transport.http v2.4.0-beta.2
pki v2.4.0-beta.2
tls v2.4.0-beta.2
tls.certificates.automate v2.4.0-beta.2
tls.certificates.load_files v2.4.0-beta.2
tls.certificates.load_folders v2.4.0-beta.2
tls.certificates.load_pem v2.4.0-beta.2
tls.handshake_match.sni v2.4.0-beta.2
tls.issuance.acme v2.4.0-beta.2
tls.issuance.internal v2.4.0-beta.2
tls.issuance.zerossl v2.4.0-beta.2
tls.stek.distributed v2.4.0-beta.2
tls.stek.standard v2.4.0-beta.2

  Standard modules: 80

dns.providers.cloudflare v0.0.0-20210401224357-964e47d3890e

  Non-standard modules: 1

  Unknown modules: 0

v2.4.0-beta.2 h1:DUaK4qtL3T0/gAm0fVVkHgcMN04r4zGpfPUZWHRR8QU=

2021/05/04 00:57:15.044 INFO    upgrade successful; please restart any running Caddy instances  {"executable": "/usr/local/bin/caddy"}

root@caddy:/ # service caddy restart
Stopping caddy.
Waiting for PIDS: 74132.
caddy version
root@caddy:/ # caddy version
v2.4.0-beta.2 h1:DUaK4qtL3T0/gAm0fVVkHgcMN04r4zGpfPUZWHRR8QU=

The next step was to attempt a full rebuild. Still no change.

root@caddy:/ # xcaddy build --output /usr/local/bin --with
2021/05/04 09:03:44 [INFO] Temporary folder: /tmp/buildenv_2021-05-04-0903.227026856
2021/05/04 09:03:44 [INFO] Writing main module: /tmp/buildenv_2021-05-04-0903.227026856/main.go
2021/05/04 09:03:44 [INFO] Initializing Go module
2021/05/04 09:03:44 [INFO] exec (timeout=10s): /usr/local/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2021/05/04 09:03:44 [INFO] Pinning versions
2021/05/04 09:03:44 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v
go get: added v2.3.0
2021/05/04 09:03:56 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v
go get: added v0.0.0-20210401224357-964e47d3890e
go get: upgraded v2.3.0 => v2.4.0-beta.2
2021/05/04 09:03:59 [INFO] Build environment ready
2021/05/04 09:03:59 [INFO] Building Caddy
2021/05/04 09:03:59 [INFO] exec (timeout=0s): /usr/local/bin/go mod tidy
2021/05/04 09:04:05 [INFO] exec (timeout=0s): /usr/local/bin/go build -o /usr/local/bin -ldflags -w -s -trimpath
2021/05/04 09:04:14 [INFO] Build complete: /usr/local/bin
2021/05/04 09:04:14 [INFO] Cleaning up temporary folder: /tmp/buildenv_2021-05-04-0903.227026856
root@caddy:/ # service caddy restart
Stopping caddy.
Waiting for PIDS: 77958.
root@caddy:/ # caddy version
v2.4.0-beta.2 h1:DUaK4qtL3T0/gAm0fVVkHgcMN04r4zGpfPUZWHRR8QU=

At this stage, it appears I’m unable to build Caddy 2.4.0-RC1 with the Cloudflare module from the source.

You need to specify that version in the xcaddy command. Those commands will attempt to build the latest stable version, or the latest version that meets the requirements of the plugins you need.

Run xcaddy like this:

xcaddy build v2.4.0-rc.1 --output /usr/local/bin --with

Gotcha! Thanks @francislavoie

root@caddy:/ # xcaddy build v2.4.0-rc.1 --output /usr/local/bin --with
2021/05/04 09:35:23 [INFO] Temporary folder: /tmp/buildenv_2021-05-04-0935.348485529
2021/05/04 09:35:23 [INFO] Writing main module: /tmp/buildenv_2021-05-04-0935.348485529/main.go
2021/05/04 09:35:23 [INFO] Initializing Go module
2021/05/04 09:35:23 [INFO] exec (timeout=10s): /usr/local/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2021/05/04 09:35:23 [INFO] Pinning versions
2021/05/04 09:35:23 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v
go: downloading v2.4.0-rc.1
go: downloading v0.13.1
go: downloading v0.0.0-20201231184435-2d18734c6014
go: downloading v1.2.0
go: downloading v2.0.6
go get: added v2.4.0-rc.1
2021/05/04 09:35:38 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v
go get: added v0.0.0-20210401224357-964e47d3890e
2021/05/04 09:35:41 [INFO] Build environment ready
2021/05/04 09:35:41 [INFO] Building Caddy
2021/05/04 09:35:41 [INFO] exec (timeout=0s): /usr/local/bin/go mod tidy
go: downloading v0.20.1
go: downloading v1.5.0
go: downloading v0.1.4
go: downloading v0.1.3
2021/05/04 09:35:44 [INFO] exec (timeout=0s): /usr/local/bin/go build -o /usr/local/bin -ldflags -w -s -trimpath
2021/05/04 09:36:02 [INFO] Build complete: /usr/local/bin
2021/05/04 09:36:02 [INFO] Cleaning up temporary folder: /tmp/buildenv_2021-05-04-0935.348485529
root@caddy:/ # service caddy restart
Stopping caddy.
Waiting for PIDS: 78844.
root@caddy:/ # caddy version
v2.4.0-rc.1 h1:tZl6bDhlwtRwuWpebRUYpDJPhJaGyrXIMp7fmuMXwMc=

This topic was automatically closed after 120 days. New replies are no longer allowed.