Simplifying my Caddyfile

Skipping the template because I think my question is fairly easily explained.

Basically I have a primary domain and a bunch of subdomains. Right now for each domain (primary+all subs) I have the following info in an effort to secure things up:

tls my_email {
        dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}

header {
        request_header -Referer
        header_upstream X-Forwarded-For {>CF-Connecting-IP}
        Strict-Transport-Security max-age=31536000;
        X-Content-Type-Options nosniff
        X-Frame-Options DENY
        Referrer-Policy no-referrer-when-downgrade
        X-XSS-Protection 1
}

but is this necessary to put in every entry, or can I just define these items for the primary domain and the others will inherit automatically? I want to clean up my caddyfile :slight_smile:

The feature you’re looking for is Caddyfile snippets.

2 Likes

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