How X-Content-Type-Options Works
How X-Content-Type-Options Works
The X-Content-Type-Options header accepts a single directive:
X-Content-Type-Options: nosniff
This directive instructs browsers to strictly follow the Content-Type header provided by the server, disabling any content sniffing behavior. When browsers encounter this header, they:
- Block requests if the Content-Type doesn't match the expected type
- Prevent script execution if files aren't served with JavaScript MIME types
- Block stylesheet application if files lack proper CSS MIME types
- Refuse to render images with incorrect MIME types in certain contexts