'Set custom global variables in Caddyfile
I have multiple reverse_proxy entries that share the same destination host. Isn't there a way to set a global variable inside the Caddyfile in order to reuse it?
app1.dns {
reverse_proxy myhost:xxxx
}
app2.dns {
reverse_proxy myhost:yyyy
}
app3.dns {
reverse_proxy myhost:zzzz
}
Solution 1:[1]
Caddy Snippets
The re-usable global configuration is possible to define once use anywhere within caddyfile, example here
(snippet) {
respond "Yahaha! You found {args.0}!"
}
(hello) {
respond "Hello {args.0}!"
}
a.example.com {
import snippet "Example A"
}
b.example.com {
import hello "World"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jinna Balu |
