Security headers
X-Content-Type-Options: nosniff tells the browser to trust the Content-Type your server sends instead of guessing a file's type from its contents.
Not sure whether your site has this problem? Check it in seconds.
Content sniffing can make a browser treat an uploaded file as a script or stylesheet even though your server labelled it something harmless. nosniff turns that behaviour off.
Look for X-Content-Type-Options: nosniff in the response headers.
Header value
X-Content-Type-Options: nosniffNginx
add_header X-Content-Type-Options "nosniff" always;Apache
Header always set X-Content-Type-Options "nosniff"Next.js (next.config.ts)
const nextConfig = {
async headers() {
return [
{
source: "/:path*",
headers: [{ key: "X-Content-Type-Options", value: "nosniff" }],
},
];
},
};
export default nextConfig;No. nosniff is the only value browsers recognise.
Guidance is general. Test header and DNS changes on a staging copy first, and check your hosting provider's documentation for platform-specific steps.