Wildcard for default in the Caddyfile settings

I want do do something like this:

mysite.com {
  root /someplace
}

myothersite.com {
  root /someotherplace
}

* {
  gzip
  log syslog
  errors {
    404 /my404.html
  }
}

So that both sites use gzip and the same error pages. My Caddyfile is looking pretty repetitive…

The Caddyfile doesn’t do inheritance or cascading or anything fancy like that. It’s pretty simple. I know people want those complex scripting capabilities, but I don’t think it’ll happen (esp. not in v1). You can use the import statement to put the shared configuration into a file and then import that into each site that uses them instead.

2 Likes

I was expecting such a that-feature-doesn’t-exist-but-you-can-do-this answer. Import is perfect though. Thanks for making caddy!

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