Guides · Security headers

X-Content-Type-Options: nosniff

One of the checks in every audibot report. This page says exactly what audibot reads, what passes, and how to fix it.

What audibot checks

Whether the X-Content-Type-Options response header on the home page contains nosniff.

Why it matters

Without it, a browser may ignore the declared Content-Type and guess from the content — treating an uploaded text file as a script, for example. nosniff makes it trust the declared type.

How do I set X-Content-Type-Options: nosniff?

Send the header on every response. It has one valid value and no side effects on a site that labels its files correctly.

nginx

add_header X-Content-Type-Options "nosniff" always;

Apache (mod_headers)

Header always set X-Content-Type-Options "nosniff"

Caddy

header X-Content-Type-Options "nosniff"

Cloudflare

Rules → Transform Rules → Modify Response Header → Set static:
X-Content-Type-Options = nosniff

Related tools

Other checks in Security headers

Security headers in the methodology ·All guides

This check is one step of the website launch checklist.

Check your site

audibot runs this check and every other one in a single audit, and publishes the report with a recommendation for each finding.