Skip to main content
All Terms Glossary

X-Content-Type-Options

Definition

X-Content-Type-Options is a HTTP header that prevents browsers from MIME-sniffing a response away from the declared content-type. This helps prevent attacks where browsers might interpret files as a different content-type than what was intended. The header should be set to 'nosniff' to enforce strict MIME type checking.

What X-Content-Type-Options does

X-Content-Type-Options is a response header with a single meaningful value, nosniff. Normally, if a server's declared Content-Type looks wrong or is missing, a browser may sniff the bytes and guess the real type, a convenience feature that can be dangerous. With nosniff, the browser stops guessing and honours the declared Content-Type exactly. It refuses to execute a response as script or stylesheet unless the type matches (for example text/javascript or text/css), and it strengthens Cross-Origin-Read-Blocking protections. In practice this means a file the server labels text/plain cannot be coerced into running as JavaScript just because its contents happen to parse as valid code.

Why MIME sniffing was a risk

MIME sniffing enabled a real class of attacks. An attacker who could upload or influence a file, say a user avatar or a text document, might craft bytes that a sniffing browser interpreted as HTML or JavaScript, turning a benign upload endpoint into a vector for stored XSS. Sniffing also undermined content-type-based access controls. Setting nosniff closes that gap by forcing the browser to trust the server's declared type, so mislabelled or attacker-controlled content is rendered inertly instead of executed. It is a small, universally supported header with essentially no downside on a correctly configured site, which is why security baselines and scanners flag its absence.

How to deploy it correctly

Send X-Content-Type-Options: nosniff on every response, and make sure your application actually sets correct Content-Type headers, because nosniff will reject resources that are mislabelled. Serve user-uploaded files from a separate origin or with Content-Disposition: attachment where appropriate, and never rely on sniffing to fix wrong types. Combine it with a strong Content-Security-Policy and correct charset declarations for full coverage. This is a server- and CDN-configuration concern rather than a third-party-script problem, so it sits outside cside's payload-analysis focus; treat it as standard hardening alongside the other secure headers your framework or edge can emit by default.

Definition

What value should X-Content-Type-Options be set to?

The only valid, meaningful value is nosniff. Despite the header's plural name there is no list of options; you either send X-Content-Type-Options: nosniff to disable MIME sniffing or you omit the header entirely. Any other value is ignored by browsers, so the control is effectively on or off.

Definition

Can nosniff break a working site?

It can, but only if the server sends incorrect Content-Type headers. With nosniff, a stylesheet mislabelled as text/plain or a script served with the wrong type will be rejected instead of guessed into working. The correct fix is to set accurate Content-Type values, not to drop the header.

Got more questions

Talk to a security expert

We answer client-side security questions every day. Bring yours.

Book a demo

Want to walk through this with an engineer?

Thirty minutes, on your own site. Not a slide deck.

We'll show you:

Which third-party scripts are running on your site right now
Where you stand on PCI DSS 6.4.3 and 11.6.1
How much of your traffic is bots and AI agents

Rather just send a question?

Finding open slots…

Real humans only. We'd know.

Having trouble booking? Open scheduler in a new tab

What are you trying to solve?

Tell us in a line and we'll come back with something useful, not a generic pitch.

We usually help with:

Seeing which third-party scripts run on your site
PCI DSS 6.4.3 and 11.6.1 evidence
Bots, AI agents and account takeover

Prefer to just book a time? Pick a slot instead