I would like, ideally to configure them in one shot (pseudocode follows):
for site in [
('siteA', 'endpointA:portA'),
('siteB', 'endpointB:portB')
]:
output_config('https://{{site[0]}}.mydomain { reverse_proxy {{site[1]}} }')
It would be also wonderful to have some conditional actions in such a template.
Is this available in Caddy? (probably no)
Is there something close to that (probably no, except snippets)
Is this part of a long-term strategy?
I can’t say we have plans to expand on Caddyfile templating, it’s not a common concern and it would take a lot of effort to implement in a flexible way.
Oh yes - thanks! I have several nested snippets so this is a natural extension. Great idea
I’ve written my own at some point but wanted something native to caddy.
I’ve used this for quite a long time but it probbaly not going to be maintained for caddy v2 andthe overload on the docker-compose file is not worth the effort. Caddyfiles are nice too.
I wrote in the past a tool that was talking with the docker engine and building up a JSON caddy configuration. But again - not worth the effort vs. a Caddyfile which I find more elegant.
I stopped isn’t it when I read in one of the big reports a discussion about its future where Lucas mentioned that with Traefik he did not see much sense in going forwards.
Happy to hear this changed, it is a great piece of work.
I used that, then Traefik (1 and 2), then my own tool that was making use of the caddy API to finally end up with a plain Caddyfile
I proxy about 30 containers, they change sometimes but not often enough to be forced to use an edge router for them.