Single Page Plaintext Caddy Sites
June 15, 2026
I was setting up MTA-STS on some domains (something I should have done a while ago, but better late than never) and had a tiny realization about how to optimize the process. Rather than set up a site just for the mta-sts subdomain and host the /.well-known/mta-sts.txt file, why not just have Caddy do all of that for me?
Since the entire purpose of this “site” is to serve a single file, this is the perfect case for Caddy’s respond directive:
mta-sts.example.com {
respond /.well-known/mta-sts.txt 200 {
body `version: STSv1
mode: testing
mx: mail.example.com
max_age: 86400`
}
}That’s it. An entire website and hosted page, right from the Caddyfile! If you ever need to serve a single page on a specific subdomain (as is the case with an MTA-STS setup), this is a pretty easy and straightforward way to do it.
评论
?
参与讨论