Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Missing X-Content-Type-Options header: how to find and fix it

OPS-172Low impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Every file your server sends comes with a Content-Type header, such as text/html or image/png. Some browsers ignore it and look at the file's contents to guess the type. This is called MIME sniffing (MIME type means the file type label).

The X-Content-Type-Options header with the value nosniff tells the browser to trust the declared type and not guess. Without it, a user-uploaded file labelled as text or an image could be treated as a script if its contents look like one.

Why it costs you leads or sales

A missing header does not break your forms or checkout. The risk is indirect. If your site lets visitors upload files, or serves content from user input, sniffing can help an attacker get a script to run in your visitors' browsers. That can lead to defaced pages, injected redirects or stolen sessions, which hurt trust and conversions.

It also shows up as a warning in security scanners, agency audits and some vendor questionnaires. Fixing it removes an easy objection when a client or partner reviews your site.

How sniffing can turn an upload into a script
  1. File uploadedLabelled as plain text or an image
  2. Server sends fileNo nosniff header
  3. Browser sniffs contentGuesses it is a script
  4. Script runs on your domainVisitor trust and sessions at risk

Without nosniff, the browser may override the declared file type.

How to check if your site has it

You need to look at the response headers your server sends. Pick one of these methods.

Check the header
  1. Use your browser

    Open your page, open DevTools (F12), go to the Network tab, reload, click the first document request and read Response Headers. Look for x-content-type-options: nosniff.

  2. Or use curl

    Run the command below in a terminal and look for the header in the output.

  3. Or use an online header scanner

    Free security header testers list the header as present or missing for any URL.

  4. Test more than the homepage

    Check a static file (an image or CSS file) and an upload folder URL too. Headers are sometimes set for pages but not for static files, or the reverse.

Check headers with curlbash
curl -sI https://www.example.com/ | grep -i x-content-type-options
# Expected: x-content-type-options: nosniff

How to fix it

Set the header once, as high up as you can: at the CDN or web server if you control it, otherwise in the platform or a plugin. Avoid adding it in several places, because duplicates can produce a repeated value like nosniff, nosniff, which some browsers may not accept.

Add the nosniff header by platform
  1. Use server config if you can

    On Apache, add the .htaccess rule from the Custom code tab. On nginx, add the add_header line to the server block.

  2. Or use a security headers plugin

    Several security and header plugins include an option for X-Content-Type-Options. Enable it, save and clear any cache.

  3. Or use PHP

    Add header('X-Content-Type-Options: nosniff'); in a small plugin or your child theme's functions.php inside an init hook. This covers PHP-served pages only, not static files.

Apache: add to .htaccesshtaccess
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
</IfModule>
nginx: add inside the server blocknginx
add_header X-Content-Type-Options "nosniff" always;

How to confirm it's fixed

Confirm the change
  • Clear your site, plugin and CDN caches.
  • Run the curl command and see x-content-type-options: nosniff once, not twice.
  • Check a page, an image and a CSS or JavaScript file.
  • Open key pages with DevTools Console open and look for 'blocked due to MIME type' errors.
  • Submit your main lead form and run a test checkout to be sure nothing broke.
  • Re-run an online security header scan.
Response headers before and after

Before

  • No X-Content-Type-Options header
  • Browsers may guess file types
  • Security scanners show a warning

After

  • X-Content-Type-Options: nosniff on all responses
  • Browsers trust the declared file type
  • Scanner warning cleared

How to prevent it happening again

Headers often disappear when you change hosts, switch CDN, rebuild a server or reset a plugin. Keep the header in one documented place, ideally in server or CDN configuration kept under version control.

Keep it in place
  • Record where the header is set (server, CDN or plugin).
  • Re-run a header check after migrations, host changes and CDN changes.
  • Add the header to your launch checklist for new sites.
  • Schedule a monthly or quarterly security header scan.
  • Serve uploaded files with correct types and avoid user-controlled content types.

How FunnelGuard handles this

FunnelGuard does not check for the X-Content-Type-Options header today. It is a possible future check.

What FunnelGuard does do is run your real customer journeys, such as lead forms and checkouts, on a schedule and check each step, the tracking hits and whether test leads arrive. If a header change blocks a script or breaks a form, that kind of journey failure is what it is built to notice. It does not tell you the header itself is missing.

To watch for the missing header, run the curl command above after each deploy or host change, or schedule a recurring scan with a free online security header tester. You can also try the free read-only FunnelGuard website audit, and the Free plan covers 1 site and 2 journeys with daily checks and no card.

Frequently asked questions

Questions people ask

What does the X-Content-Type-Options nosniff header do?

It tells the browser to trust the Content-Type your server declares and not guess a file's type from its contents. This stops a file labelled as text or an image from being run as a script. The only valid value is nosniff.

Why does my security scan say X-Content-Type-Options is missing?

The scanner requested your page and found no x-content-type-options header in the response. Your server, CDN or platform is not sending it. Add it at the server or CDN level and scan again.

How do I add X-Content-Type-Options nosniff in nginx or Apache?

In nginx, add add_header X-Content-Type-Options "nosniff" always; to the server block and reload. In Apache, add Header always set X-Content-Type-Options "nosniff" to .htaccess or the virtual host, with mod_headers enabled.

Can nosniff break my website?

Yes, if some files are served with the wrong type. A stylesheet sent as text/plain or a script sent as text/html will be blocked once nosniff is on. Check the browser console for MIME type errors after you add it, and fix the file type on the server.

How do I add X-Content-Type-Options on WordPress?

The cleanest way is a server rule in .htaccess (Apache) or nginx config. If you cannot edit those, use a security headers plugin that has an option for it, or send the header from PHP in a small plugin. Then confirm with curl.

Can I add this header on Wix or Squarespace?

Not directly. Both platforms control their own response headers and do not let you set custom ones. Test with curl, and if you need the header, you would have to put a proxy or CDN in front of your domain.

Is a missing X-Content-Type-Options header a serious problem?

It is low risk on its own. It mainly matters if your site serves uploaded or user-supplied content. It is still worth fixing because it is a one-line change and a common audit finding.

Does FunnelGuard check for the X-Content-Type-Options header?

No. It is a possible future check. FunnelGuard runs your customer journeys and checks forms, tracking and lead delivery, so use curl or an online header scanner to watch this header.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: site safety (Stage 26, daily): X-Content-Type-Options.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.