Back to Articles
Troubleshooting2026-06-18•3 min read•CSR.plus Team

Mixed Content Errors: Why They Happen and How to Fix Them

Mixed Content Errors: Why They Happen and How to Fix Them

A mixed content error occurs when an HTTPS page loads a subresource (script, image, iframe, stylesheet, fetch) over plain HTTP. Browsers block "active" mixed content entirely and increasingly warn on the rest, because it weakens the page's secure context. The fix is to serve every subresource over HTTPS — via relative URLs, absolute https:// URLs, or a Content-Security-Policy upgrade-insecure-requests response header.

How mixed content breaks a secure context

A page served over HTTPS inherits a secure context. Any subresource loaded over plain HTTP breaks it and exposes the page to downgrade attacks. The browser logs each blocked URL in the console with a clear message.

Active vs passive mixed content

"Active" mixed content (scripts, iframes, fetch/XHR) is blocked entirely by browsers because it can be used to tamper with page behavior. "Passive" content (images, audio, video) is also increasingly blocked or flagged by modern browsers.

How to find every occurrence

Open DevTools > Console, filter for "Mixed Content", and copy each blocked URL, then search your codebase for http:// references to those hosts. This is the prerequisite for a real fix — patching only the symptom will recur.

Step 1: Open the console and list blocked requests

On the affected page press F12 → Console, search for "Mixed Content", and copy each blocked http:// URL as your fix list.

Step 2: Replace absolute http:// URLs in your code

In templates, CSS, JS, and config files, change those http:// resources to https://. Prefer same-origin or CDN resources that already offer HTTPS.

Step 3: Use absolute HTTPS or relative URLs

Change http://cdn.example.com/x.js to https://cdn.example.com/x.js (absolute HTTPS) or to a relative path /x.js. Do not use protocol-relative //host/... URLs: they inherit the page scheme and silently load over HTTP if the page is ever served without TLS.

Use absolute https:// or relative /path URLs. Do not use protocol-relative //host/... URLs — they inherit the page scheme.

Step 4: Add the CSP upgrade-insecure-requests header

Add the response header Content-Security-Policy: upgrade-insecure-requests on the server/CDN; the browser rewrites http:// subresources to https:// instead of blocking them. This works for most static pages immediately.

Step 5: Verify the fix

Reload the page and confirm no Mixed Content appears in the Console; spot-check across browsers. For a hardcoded http:// API that offers no HTTPS, you must change the code or add an HTTPS proxy — there is no client-side workaround.

Troubleshooting checklist

SymptomLikely causeFix
Scripts/iframes not loading on an HTTPS pageActive mixed content blockedSwitch resource URLs to https:// or //
Images blocked or marked "not secure"Passive mixed contentUse HTTPS sources or a CSP upgrade header
Works in one browser, broken in anotherDifferent blocking strictnessApply a universal HTTPS fix, not a browser-specific one
Hardcoded http:// API endpointThird party offers no HTTPSProxy via HTTPS or change the code
Recurring after a deployAbsolute http:// still in templates/assetsSearch the codebase for http:// and fix at the source

Related articles

FAQ

Why do other browsers work but mine is broken?

Older browsers or relaxed policies may load mixed content silently, while modern browsers block it — that is why behavior differs. Fix to the strictest browser's behavior.

Does HSTS fix mixed content?

No. HSTS prevents HTTP page loads but does not rewrite embedded `http://` resources. Use `upgrade-insecure-requests` or fix the URLs directly.

Can upgrade-insecure-requests fix everything?

It works for most static pages, but it only rewrites subresource addresses — it cannot serve a third-party endpoint that simply does not support HTTPS. That case requires code changes or an HTTPS proxy.

Free SSL/TLS tools

Verify and inspect your certificates in seconds.

Related Certificate Info

Learn more about choosing and buying certificates.

Related articles