The HTTP Content-Security-Policy
(CSP) block-all-mixed-content
directive prevents loading any assets using HTTP when the page is loaded using HTTPS.
All mixed content resource requests are blocked, including both active and passive mixed content. This also applies to <iframe>
documents, ensuring the entire page is mixed content free.
The upgrade-insecure-requests
directive is evaluated before block-all-mixed-content
and If the former is set, the latter is effectively a no-op. It is recommended to set one directive or the other – not both.
Content-Security-Policy: block-all-mixed-content;
Content-Security-Policy: block-all-mixed-content; <meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
To disallow http assets on a more granular level, you can also set individual directives to "https:". For example, to disallow insecure http images:
Content-Security-Policy: img-src https:
Specification | Status | Comment |
---|---|---|
Mixed Content The definition of 'block-all-mixed-content' in that specification. | Candidate Recommendation | Initial definition. |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | Yes | ? | 48 | No | Yes | ? |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | Yes | Yes | ? | 48 | No | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content