Caddy HTTP server

Caddy is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go.

Step 1: Configuring the Caddyfile and flags

Tell caddy to run its HTTP server, and where to find its Caddyfile:

mkdir -p flags/
cat > flags/ <<'EOT'

Include the config file in the gokrazy image at /etc/caddy/Caddyfile:

mkdir -p extrafiles/
cat > extrafiles/ <<'EOT'
http://:80 {
	root * /tmp
	file_server browse 

Note: In the above Caddyfile, we have explicitly configured an HTTP listener to disable Caddy’s automatic HTTPS setup, so that your server will work without a publically reachable address.

Step 2: Install Caddy to your gokrazy device

In your gokr-packer invocation (see Quickstart if you don’t have one yet):

  1. include the caddy package
  2. set the -http_port flag to move the gokrazy web interface listening port out of the way and let caddy serve on TCP port 80. The special -update=:80 syntax is the same as -update=yes, but forcing this update to happen via port 80. In later gokr-packer runs, use -update=yes instead.
gokr-packer \
  -update=:80 \
  -http_port=1080 \ \ \ \

Tip: When using breakglass, use the -gokrazy_url=:1080 flag to overwrite the port.