webzod
account

Serve security.txt from /.well-known/ on Caddy

hygiene.security_txt.legacy_location · effort: minutes

Why it matters

RFC 9116 puts the file at /.well-known/security.txt and keeps /security.txt only for older setups. Researchers and tools look in the standard place first.

The fix

  1. Add a rewrite to the site block of example.com so the standard address serves the existing file, before your file_server or proxy lines.
  2. If the site is behind reverse_proxy, the rewrite only changes the path that is sent to the application, so the application itself must serve /security.txt. Otherwise serve the file with file_server, as in the security.txt fix.
  3. Run caddy reload and open https://example.com/.well-known/security.txt.
Caddyfile
example.com {
	rewrite /.well-known/security.txt /security.txt
	# keep the rest of your site configuration here
}

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.