X-Content-Type-Options: nosniff check

Short answer

X-Content-Type-Options: nosniff tells browsers to trust the Content-Type your server sends instead of guessing. That stops an uploaded file that pretends to be an image from being run as a script. It's a one-line header; SiteShield fails a site without it (3 of 100 points).

Browser protectionWorth 3 of 100 pointsBy Mumshad JawadUpdated

What is X-Content-Type-Options?

Browsers used to "sniff" a file's content and guess its type when the server's Content-Type looked wrong. With nosniff, a response labelled text/plain or image/png is never executed as JavaScript or rendered as HTML, and scripts and stylesheets with the wrong type are refused.

Why it matters

Stops browsers from guessing file types, which attackers can abuse to run uploaded files as scripts.

Any site that accepts uploads (CVs, profile photos, support attachments) is at risk: an attacker uploads a file that is really HTML or JavaScript, then sends a victim the link. Without nosniff, some browsers will run it on your domain, with access to your visitors' cookies and sessions.

SiteShield maps this check to:

OWASP ASVS V14.4

See how these standards fit together in the UAE website security checklist.

How SiteShield grades it

This check, "X-Content-Type-Options", can cost up to 3 points: a fail loses all 3, a warning loses 2. Every scan starts at 100.

ResultWhenPoints lost
PassX-Content-Type-Options: nosniff is present.0
FailThe header is missing or has another value.3

How to check it yourself

curl -sI https://example.com | grep -i x-content-type-options
# x-content-type-options: nosniff

Or run a free SiteShield scan, which checks this and 16 other settings in one go.

How to fix it

The quick version: Send X-Content-Type-Options: nosniff

Cloudflare

Rules → Transform Rules → Modify Response Header: set static header X-Content-Type-Options to nosniff. Cloudflare's Managed Transforms (under Rules) also include "Add security headers", which adds it together with a few others.

Nginx

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

Apache

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

WordPress

Set at the server/CDN, or:

add_action('send_headers', function () {
    header('X-Content-Type-Options: nosniff');
});

FAQ

Can nosniff break my site?

Only if your server sends wrong Content-Type headers for scripts or stylesheets (for example JavaScript served as text/plain). Fix the type and the header is safe.

Do I still need it if I don't accept uploads?

Yes, it costs nothing and also protects against mislabelled third-party files. It's one of the standard headers in the OWASP ASVS configuration chapter.

Test your X-Content-Type-Options now

Run all 17 checks on your website and email domain in about 30 seconds. Free, no signup, passive checks only.

Rather not do it yourself? Fix it for me starts at AED 750 (about USD 205 by PayPal), quote agreed first. Monitoring re-scans weekly for AED 99/month or AED 990/year.

Related checks

See all 17 security checks →