Hello,
I have three domains on my caddy server and I would like to re-use the same configuration for all of them. How can I do that in Caddyfile so I don’t have duplicate configuration allover the place?
As you can see in in example everything except root/proxy is duplicated which sucks. Is there any way to avoid this?
Example (Caddyfile):
domain1.com {
root /var/www/domain1.com
expires {
match .js$ 1y
match .css$ 1y
match .html 5i
}
header / {
Strict-Transport-Security "max-age=31536000;"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
-Server
}
log /var/log/caddy/access.log
error /var/log/caddy/error.log
gzip
}
domain2.com {
proxy / localhost:8081
expires {
match .js$ 1y
match .css$ 1y
match .html 5i
}
header / {
Strict-Transport-Security "max-age=31536000;"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
-Server
}
log /var/log/caddy/access.log
error /var/log/caddy/error.log
gzip
}