X-Content-Type-Options (X-Content-Type-Options)

Security Glossary - Security Headers

Definition: X-Content-Type-Options is a security header with a single valid value: nosniff. It prevents browsers from MIME-type sniffing - guessing the content type of a response by examining its content rather than trusting the Content-Type header. This stops certain types of attacks where a file served as one type is interpreted as another.

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

Frequently Asked Questions

Can X-Content-Type-Options break anything?
In rare cases, if your server sends incorrect Content-Type headers (like serving JavaScript with text/plain), nosniff will prevent the browser from executing it. The fix is to correct the Content-Type header, not to remove nosniff.
Why is there only one valid value?
The header was designed for a single purpose: disabling MIME sniffing. The only valid value is 'nosniff'. There is no 'sniff' value because MIME sniffing is the default browser behavior when the header is absent.
Disclaimer: DomainOptic provides automated informational scans only. Results do not constitute professional security advice, compliance certification, or a guarantee of security. Always verify findings independently.