Can I have a default configuration applied to all entries?

1. The problem I’m having:

I need to apply a specific setting to all sites defined in my configuration (specifically forcing all sites to be authenticated with Authelia)

3. Caddy version:

root@srv /e/d/caddy# docker-compose exec caddy caddy version
v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=

4. How I installed and ran Caddy:

a. System environment:

Official docker image

What I do today

I have a snippet that I include as part of each site configuration, such as

https://foo.swtk.eu {
	import authenticate-with-authelia
	reverse_proxy foo:8080
}

It works fine but there are now major drawbacks to this (scaling, forgetting to add the snippet, convoluted configuration, …)

I would like to avoid adding it and have the import done automatically for each site definition. Alternatively to add the content of the snippet to a “global definition” that is added by default to all sites.

Is this possible?

No.

Snippets are the correct solution.

We’ll never add globally configured routes, because then that opens the question of “how do I opt-out of these global routes for this one site?” and that’s complicated and it’s not worth going down that path.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.