Caddy
Caddy obtains and renews TLS certificates by itself, which makes it the shortest path to a production Vela. The example examples/caddy/Caddyfile covers the fs-direct and r2 scenarios; nginx accel has no Caddy equivalent.
Requirements
VELA_ACCEL_PREFIXempty (the default).- Ports 80 and 443 reachable from the internet for the ACME challenge and HTTPS.
- A DNS record for your hostname pointing at the host.
The Caddyfile
# Caddy obtains and renews the TLS certificate itself and redirects HTTP to
# HTTPS with the query intact, so signed links keep working.
{
# Never log query strings: signed links carry their signatures there.
# Caddy's handler errors record the full request, so they go through
# the same filter as access logs.
log default {
exclude http.log.error
}
log vela_errors {
include http.log.error
format filter {
wrap json
request>uri regexp \?.*$ ""
request>headers delete
}
}
}
# CHANGE ME: public hostname.
store.example.com {
log {
output file /var/log/caddy/vela.access.log
format filter {
wrap json
request>uri regexp \?.*$ ""
request>headers delete
resp_headers delete
}
}
# velad trusts these only from VELA_TRUSTED_PROXIES, so the proxy
# must always set them. reverse_proxy adds X-Forwarded-For/-Proto.
request_header X-Real-IP {remote_host}
request_header X-Request-ID {http.request.uuid}
header {
Strict-Transport-Security "max-age=31536000"
>X-Content-Type-Options nosniff
}
handle_errors {
header {
Strict-Transport-Security "max-age=31536000"
X-Content-Type-Options nosniff
}
}
# API: request bodies stream to velad. Keep in sync with VELA_MAX_UPLOAD.
handle /api/* {
request_body {
max_size 2GiB
}
reverse_proxy 127.0.0.1:8080
}
# Signed links, the index, direct URLs and theme assets.
handle {
request_body {
max_size 1KiB
}
reverse_proxy 127.0.0.1:8080
}
}
What it does
Global log blocksCaddy's handler errors (for example when velad is unreachable) include the full request URI. Routing them through a filter that strips the query and all headers keeps signed-link signatures out of every log file.
format filter … request>uri regexp \?.*$ ""Removes everything after ? from logged URIs. Headers are deleted entirely so neither credentials nor referrers with queries are recorded. Caddy already redacts Authorization; this goes further.
request_header X-Real-IP / X-Request-IDReplaces whatever the client sent. With the container on loopback the default VELA_TRUSTED_PROXIES already trusts Caddy.
>X-Content-Type-Options nosniffThe > prefix replaces the header after proxying, so every response — including Caddy's own errors via handle_errors — carries it exactly once.
request_body max_size2GiB for /api/*, matching the default VELA_MAX_UPLOAD; 1KiB for everything else because the public side never accepts bodies — the optional web sign-in form posts one short field and fits easily. Caddy streams request and response bodies by default.
Web sign-in works out of the boxThe Caddyfile needs no changes for web sign-in: Caddy forwards Vary, Cache-Control and the upload sandbox as velad sends them. Just don't add a cache in front, and bypass any CDN cache for the __Host-vela_session cookie.
Install and validate
sudo install -m 0644 examples/caddy/Caddyfile /etc/caddy/Caddyfile
sudoedit /etc/caddy/Caddyfile # replace store.example.com (and the upstream port if changed)
sudo install -d -o caddy -g caddy /var/log/caddy
caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
If you changed VELA_HOST_PORT, update both reverse_proxy lines. If you raise VELA_MAX_UPLOAD, raise max_size under /api/* too.
Keep the log filters if you customize logging. Adding a plain log directive, or a CDN in front that logs full URLs, would record working signed links.
Caddy in Docker
When Caddy itself runs in a container on a user-defined network with velad, point reverse_proxy at the container name (for example vela:8080) and add Caddy's single container address to VELA_TRUSTED_PROXIES. Do not trust the whole network.