Serve security.txt as text/plain with utf-8
Why it matters
RFC 9116 requires the file to be sent as text/plain in utf-8. Tools may reject it if the server labels it as html, binary or another charset.
The fix
- Check what the server sends with curl -sI https://example.com/.well-known/security.txt and look at the Content-Type line.
- Serve the file as a static file named security.txt with the type text/plain; charset=utf-8. A page built by a framework route or a catch-all rewrite to index.html is the usual cause of text/html.
- Save the file itself as utf-8 without special characters in the wrong encoding.
bash
curl -sI https://example.com/.well-known/security.txt | grep -i content-type The examples use example.com. Replace it with your own domain.
Related
- Reported by the security.txt check
- Publish a security.txt file
- Serve security.txt from /.well-known/
- Serve security.txt over https
- Add a Contact line to security.txt
- Fix the Contact value in security.txt
- Add an Expires line to security.txt
- Use an RFC 3339 date in the Expires line
- Renew the expired security.txt
- Renew security.txt before it expires
- Shorten the security.txt Expires date
- Fix repeated or insecure fields in security.txt
- Make the Canonical line match where the file is served
Scan your domain to see whether this applies to you.