1. The problem I’m having:
I have a fairly generic set of header and subheader directives applied to a majority of my domains/subdomains. Right now, I’m storing them in a snippet along with my custom Porkbun DNS TLS directive:
(headers) {
encode gzip
header Content-Security-Policy "upgrade-insecure-requests"
}
(subheaders) {
header_up X-Real-IP {remote}
header_down Strict-Transport-Security max-age=31536000
}
(porkbun) {
tls {
dns porkbun {
api_key {env.PORKBUN_API_KEY}
api_secret_key {env.PORKBUN_API_SECRET_KEY}
}
}
}
This is how most of the subdomains look as a result:
sftp.mydomain.com {
import headers
import porkbun
reverse_proxy sftpgo:8080 {
import subheaders
}
}
Is there any way to format the subheader snippet so that I can add it to the same location as ‘headers’ and ‘porkbun’ so I don’t have to create so many additional lines in my Caddyfile and keep it easy to read at a glance?
For example:
sftp.mydomain.com {
import headers
import porkbun
import subheaders
reverse_proxy sftpgo:8080
}
Or is there altogether a better way I should be approaching this?
2. Error messages and/or full log output:
N/A
3. Caddy version:
Latest
4. How I installed and ran Caddy:
docker compose
a. System environment:
b. Command:
N/A
c. Service/unit/compose file:
N/A
d. My complete Caddy config:
N/A