Caddy is a super webserver that has many useful features. Caddy can enable very very powerful scenarios and many of them are documented in this Wiki. As these scenarios become more elaborate (some might say complex!) writing a caddy config file starts to feel more like programming than basic configuration.
When that starts to happen I find myself reaching out for variables to enable multiple scenarios in a single configuration file by manipulating those variables.
For those situations caddy has a few types of variables to consider. What I hope to do here is illuminate how to use these variable types in the Caddyfile.
I will use examples to illustrate the concepts. I use the respond
directive to verify how caddy
works.