Caddy is "a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
- Setting up a reverse proxy using Caddy
- Setting up CORS in Caddy
- Making Caddy use a self-signed SSL certificate
- Enabling gzip/zstd compression in Caddy
- Enabling access logging in Caddy
Installation script on Debian/Ubuntu
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddyhandle and handle_path
The handle and handle_path directives are similar. However, handle_path will strip the path prefix from the request when matched.
handle_path /foo/* {
# The path has the "/foo" prefix stripped
}
handle /bar/* {
# The path still retains "/bar"
}
Further reading
redirfor redirects.reverse_proxyfor proxying requests to another server.