Skip to the content
Start free

No X-Content-Type-Options: nosniff

Without nosniff, browsers may guess a file's type from its contents, which can let an uploaded file run as a script.

Low priority Security and HTTPS

Why it matters #

Browsers sometimes ignore the Content-Type a server sends and guess the type from the bytes. That guessing, called MIME sniffing, can let a file uploaded as a picture or text be run as a script or a page.

X-Content-Type-Options: nosniff turns the guessing off. It is a one-line header with almost no risk, and nosniff is the only value it takes.

How to fix it #

Send "X-Content-Type-Options: nosniff" on every answer, and make sure each file is sent with its correct Content-Type, such as text/css for stylesheets and text/javascript for scripts.

Most hosts, CDNs and security plugins can add it. Check with the Security Headers Checker.

What it looks like, and fixed #

The problem
X-Content-Type-Options: nosnif

A misspelt value, which browsers ignore. Leaving the header out has the same effect.

Fixed
X-Content-Type-Options: nosniff

nosniff is the only value. Send it on every answer, with the correct Content-Type for each file.

Fix it with your AI assistant #

Paste this into ChatGPT, Claude, Gemini or your coding agent. Fill in the words in [square brackets] first. It checks before it changes anything, changes only this, and tells you how to prove it worked.

Your instruction for the AI
Help me add a security header to [your website address], which runs on [your platform or server, e.g. WordPress on Apache]. A checker says answers have no "X-Content-Type-Options: nosniff", so browsers may guess a file's type and run an uploaded file as a script. First check: run "curl -sI" on the home page, one stylesheet and one script file (or ask me to paste the headers), and report the X-Content-Type-Options value and the Content-Type of each file. Explain plainly what you found, and flag any file served with the wrong Content-Type, because nosniff will make the browser refuse those scripts and styles. Then give me the exact change: send "X-Content-Type-Options: nosniff" on every answer, in one place only, and correct any wrong Content-Type first. Rules: back up configuration first, keep all other headers, and change nothing else. Give the exact line and where it goes. Finally, tell me to re-check with the URSY.com Security Headers Checker at ursy.com/security-headers-checker/.

We find the problems, and help you fix them

  1. Check Run a free tool or the full audit.
  2. Fix it with your AI Download your AI Fix Pack and drop it into ChatGPT, Claude or Gemini. A free account is enough.
  3. Re-check Come back, check again, and watch each fix turn green.

How the AI Fix Pack works, with a sample to download

Fix it on your platform #

WordPress

Most security plugins can add it, or add Header always set X-Content-Type-Options "nosniff" to .htaccess on Apache hosting.

Your server or hosting

On nginx add add_header X-Content-Type-Options "nosniff" always; at server level. On Apache use Header always set X-Content-Type-Options "nosniff".

Your CDN (for example Cloudflare)

On Cloudflare, a response header Transform Rule can add it to every answer.

Check it is fixed #

Run the Security Headers Checker again: it should find X-Content-Type-Options set to nosniff. Check the page still looks and works the same.

Official source #

MDN: X-Content-Type-Options

Questions #

Can nosniff break anything?

Only files sent with the wrong type: a script that is not sent as JavaScript, or a stylesheet that is not text/css, will be refused. Fix the type and it works.

Do I need a developer?

Usually not. It is one line in a security plugin, the server settings or the CDN.

More problems in Security and HTTPS

See every problem in the library

For AI assistants and developers: Instructions for AI · Developers · How to cite URSY.com