X-Content-Type-Options: stop the browser from guessing a file's type
One nosniff header makes browsers honor the content type you declared instead of second-guessing it
The threat
Our scanner saw your responses come back without X-Content-Type-Options: nosniff. Without that header, browsers are allowed to βsniffβ: to ignore the Content-Type you sent and instead guess a fileβs type from its first bytes. Most of the time the guess is harmless. Sometimes it is not.
Here is where it bites. A file a visitor uploads (a profile image, a document) that quietly contains script markup can be re-interpreted by the browser as HTML or JavaScript and run in your siteβs context, even though you served it as an image. On its own that is a small crack, but it is exactly the kind of thing that turns a minor upload or content bug into a working cross-site-scripting hole. nosniff shuts the guessing off: the browser trusts the type you declared, full stop.
The exact fix
Send X-Content-Type-Options: nosniff on every response. On Netlify, add it in netlify.toml:
# netlify.toml
[[headers]]
for = "/*"
[headers.values]
X-Content-Type-Options = "nosniff"
Or the Netlify _headers form:
/*
X-Content-Type-Options: nosniff
On nginx:
add_header X-Content-Type-Options "nosniff" always;
On Apache:
Header always set X-Content-Type-Options "nosniff"
One gotcha:
nosniffmakes the browser trust yourContent-Typeexactly, so your server has to send the right one. Static hosts and Netlify already do (.jsasapplication/javascript,.cssastext/css). If a script or stylesheet stops loading right after you addnosniff, the real bug is a wrongContent-Typeon that file, fix the type, do not remove the header.
Verify it
curl -sI https://yourdomain.com | grep -i x-content-type-options
A correct result is a single line: x-content-type-options: nosniff.
Proof
apecyber.com sends nosniff on every response as part of the hardened header set behind its A / 100 grade on Netlify. The ApeCyber scanner flags the missing header passively on every scan, from the outside, touching nothing. Adding it is a clean β4 off the posture score, and it takes about three minutes.