X-Content-Type-Options is a single-purpose HTTP response header that tells browsers to not MIME-sniff responses away from their declared Content-Type. The only valid value is nosniff.
Header Format
X-Content-Type-Options: nosniff
What MIME Sniffing Is
Some browsers, historically, would look at the first bytes of a response and infer the “real” content type — treating a .txt file with HTML tags as HTML. This enabled attackers to upload files disguised as images (.jpg) that contained executable JavaScript.
Impact of nosniff
Content-Type: text/plain— treated as text, never as HTML/JS, no matter what’s in the bodyContent-Type: image/pngon something that isn’t a PNG — rendered broken, never as HTML- Blocks a full class of file-upload exploits
Recommendation
Set this header on every response. There is no downside, no compatibility risk, and no configuration to tune. Always nosniff.
Validate with the security headers checker.
Related
Check the CSP glossary entry, the HSTS glossary entry, and read the HTTP security headers explainer.