Mixed Content (Mixed Content)
Why You Should Care About Mixed Content
Mixed content undermines the security that HTTPS provides. If an HTTPS page loads a JavaScript file over HTTP, an attacker on the network can replace that script with malicious code. The user sees a secure lock icon, believing the page is fully protected, while actually executing attacker-controlled JavaScript.
Browsers categorize mixed content as "active" (scripts, stylesheets, iframes - which are blocked by default) and "passive" (images, audio, video - which may load with a warning). Active mixed content is more dangerous because it can modify the page, steal data, or redirect users. Passive mixed content can still leak information through the referrer header and allows content tampering.
Modern browsers block active mixed content by default, which means HTTP scripts on your HTTPS page simply will not load, breaking functionality. Passive mixed content may display a warning icon instead of the secure lock. To fix mixed content, update all resource URLs to use HTTPS or protocol-relative paths, and add the upgrade-insecure-requests CSP directive as a safety net.
Testing Your Configuration
A security audit checks for mixed content on your pages. Browser developer tools also flag mixed content in the console. Use the Content-Security-Policy header with the upgrade-insecure-requests directive to automatically upgrade HTTP resource requests to HTTPS.