?
This document uses PHP Chinese website manual Release
的X-Content-Type-Options
響應的 HTTP 標頭是由服務器使用以指示在通告的 MIME 類型的標記Content-Type
標頭不應該被改變,并且被遵循。這允許選擇不使用 MIME 類型的嗅探,換句話說,它可以說網(wǎng)站管理員知道他們在做什么。
微軟在 IE 8 中引入了這個頭文件,作為網(wǎng)站管理員阻止正在發(fā)生的內(nèi)容嗅探的一種方式,并且可以將不可執(zhí)行的 MIME 類型轉(zhuǎn)換為可執(zhí)行的 MIME 類型。從那以后,其他瀏覽器已經(jīng)引入了它,即使他們的 MIME 嗅探算法不那么激進。
網(wǎng)站安全測試人員通常希望設(shè)置該標題。
注意:nosniff
僅適用于“ script
”和“ style
”類型。同樣適用nosniff
于圖像原來與現(xiàn)有的網(wǎng)站不兼容。
Header type | Response header |
---|---|
Forbidden header name | no |
X-Content-Type-Options: nosniff
nosniff
阻止請求,如果請求的類型是
“ style
”,而 MIME 類型不是“ text/css
”,或者
“ script
”,而 MIME 類型不是 JavaScript MIME 類型。
Specification | Status | Comment |
---|---|---|
FetchThe definition of 'X-Content-Type-Options definition' in that specification. | Living Standard | Initial definition |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | 1.0 | (Yes) | 50 | 8.0 | 13 | No |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | 50 | (Yes) | (Yes) | No |