X-Content-Type-Options (X-Content-Type-Options)
Why X-Content-Type-Options Matters
Without X-Content-Type-Options: nosniff, browsers may interpret a file differently from what the server intended. An attacker who can upload a file with a .jpg extension but containing JavaScript could trick the browser into executing it as a script if the browser sniffs the content and detects JavaScript.
This header is simple to implement and has no legitimate reason to be omitted. It consists of a single directive (nosniff) that tells the browser to trust the Content-Type header and not attempt to guess. There are no configuration options, no compatibility concerns with modern browsers, and no risk of breaking functionality.
X-Content-Type-Options is consistently recommended by security scanners and is part of the baseline security headers every site should set. Along with X-Frame-Options and a basic CSP, it forms the minimum security header set.
Checking Your Setup
A security audit checks for the X-Content-Type-Options header. It should be set to "nosniff" on all responses. This is a one-line server configuration change with no downsides.
Run a Security Audit