Sitewalk / Guides / Issue guides / X-Content-Type-Options

X-Content-Type-Options nosniff: how to check yours and add it

X-Content-Type-Options: nosniff tells the browser to trust the file type your server declares instead of guessing it from the content. It is the cheapest security header to add.

Does your site send it?

curl -I https://yoursite.com/

Look for x-content-type-options: nosniff.

Why it matters

MDN lists two effects. For scripts and stylesheets, the browser blocks the file if its type is wrong (not JavaScript for a script, not text/css for a style sheet). For other responses, the browser uses your Content-Type as is: a text/plain response that contains HTML will not be treated as a web page. That is what stops an uploaded file from running as a script.

How to fix it

Send X-Content-Type-Options: nosniff on all responses.

Both lines were tested on nginx and Apache 2.4 on 16 Nov 2026 (Apache needs mod_headers on). In nginx, a location block that has its own add_header line drops every header set above it, so repeat the headers there.

One check before you turn it on: your CSS and JavaScript files must be served with the right content type. With nosniff, a stylesheet sent as text/plain stops loading. Load your pages after the change and watch the Console.

Check it worked

Run the curl command again, then load a few pages and check styles and scripts still load. Then run an audit.

What Sitewalk found on real sites

50 of 87 sites (57.5%) did not send the header. Our own site sends it (checked 16 Nov 2026).

Check your whole site in one sentence

Sitewalk checks these headers along with 200+ other technical SEO checks. In ChatGPT, say:

Audit yoursite.com for technical SEO problems

Get started

Checked on 16 Nov 2026. Header behaviour from MDN Web Docs, read 16 Nov 2026. Sitewalk counts are from 87 audited sites, each site's latest audit: a small early-user group, a first look and not a survey.

More guides

All issue guides ยท All guides