webzod
account

Serve security.txt as text/plain with utf-8 on nginx

hygiene.security_txt.wrong_content_type · effort: minutes

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

  1. Serve the file from an exact-match location that sets the type and charset, inside the server block for example.com.
  2. Run nginx -t and reload nginx, then check the Content-Type header again.
/etc/nginx/conf.d/example.com.conf
location = /.well-known/security.txt {
    root /var/www/security;
    default_type text/plain;
    charset utf-8;
}

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.