Article
Mixed content: what it is, why it breaks, and how to find every instance on your site
Published 2026-11-20
Mixed content: what it is, why it breaks, and how to find every instance on your site
You moved your site to HTTPS and the padlock shows. Then someone emails you a screenshot: a grey padlock with a warning triangle, or on Firefox a padlock with a slash through it. Your page loads over HTTPS but something inside it is still being fetched over plain HTTP. That is mixed content, and it quietly undoes a chunk of the protection you just paid for.
The browser vendors have been tightening this for years, so the practical question is no longer "is this bad". It is "how do I find every http:// reference on a site I have been editing for six years". This article covers both: what actually happens when a script or image comes in over HTTP, and the concrete ways to enumerate the leftovers, from DevTools to a full source-and-database sweep.
What mixed content is
A page has mixed content when its HTML arrives over an encrypted HTTPS connection but the page then requests subresources over unencrypted HTTP. The HTML is the only part the browser guarantees to be the server's; everything else it fetches blindly from whatever URL the markup names.
<script src="http://cdn.example.com/analytics.js"></script>
<img src="http://old-images.example.com/logo.png">
<link rel="stylesheet" href="http://fonts.example.com/style.css">
The name is literal: the connection is a mix of encrypted and cleartext requests, one page, two protocols.
Why is this a security problem and not just a cosmetic warning? Because the attacker does not need to touch your server. Someone positioned on the same network (public WiFi, a compromised router, a curious ISP) can intercept the cleartext request and answer it themselves. For an image, they can swap the picture. For a script, they can return their own JavaScript, which then runs with the full privileges of your page: it can read the DOM, steal cookies the page can reach, rewrite links to send victims to a lookalike site, or keylog a login form. The padlock told the visitor the page was safe; the script said otherwise.
There is one nuance browsers are opinionated about: active versus passive. Active mixed content is anything that can execute or change the page: scripts, stylesheets, iframes, fetch() and XMLHttpRequest, fonts, objects. Passive mixed content is images, audio and video, and a few odds and ends. The distinction is fading (Safari and Chrome already upgrade or block some passive content), but it explains what you will see in practice: on Chrome today, passive images are auto-upgraded to HTTPS and only fail visibly if the upgrade does not work; scripts and stylesheets over HTTP are blocked outright, with a console message naming the URL.
Blocked, not broken-looking-broken. When a stylesheet is blocked, your page loses styling and looks obviously wrong, so somebody notices. A blocked tracking script produces no visible symptom at all. It just stops working, and nobody files a ticket. That is the failure mode worth caring about: mixed content quietly kills analytics, chat widgets, and payment scripts on parts of your site you do not stare at daily.
Why sites stay broken for years
Almost nobody writes http:// on purpose anymore. The leftovers come from three places:
Old content in the database. WordPress posts, product descriptions, imported CSV files, forum posts from 2016. Someone typed http:// into the editor and it is now part of the content. If you have ever done a "search replace" that touched wp_posts.post_content, you know this territory.
Templates that hardcode the protocol. A theme or a custom block that renders http://maps.example.com/... because that was what the docs said when it was written.
Third-party embeds. The widget vendor's snippet says <script src="http://widget.vendor.com/v1.js">. You pasted it into the footer five years ago. It still works because the vendor runs both ports, so nobody touched it.
A common trap in this situation: adding a server-side HTTP-to-HTTPS redirect does not fix mixed content. The redirect happens on your server, but the browser never sends the cleartext request to your server first. For a same-origin resource, the browser blocks the request before it leaves the machine or upgrades it, and for a cross-origin resource the request goes to some other server entirely. If the fix were "redirect more" the problem would not exist; the references themselves have to change.
How to find it, level by level
You can stop at the first level if you are lucky. Sites with a lot of user-generated or imported content usually need all four.
Level 1: DevTools console on the live page
Every Chromium-based browser and Firefox report mixed content in the console as it happens. Open the page, open DevTools (F12), and look for messages like:
Mixed Content: The page at 'https://example.com/' was loaded over HTTPS,
but requested an insecure resource 'http://old-images.example.com/logo.png'.
This request has been blocked.
Chrome also has a dedicated filter: open the Network tab, filter by "Blocked", or in the Security tab check the "Mixed content" counter if you are on a version that shows it. Firefox shows a broken padlock icon in the address bar while on the page.
The limitation is scope: you see what this one page load happened to request. Content in a tab nobody clicks, in a template used only on landing pages, or inside an accordion that never expands, will not appear. DevTools is a smoke test, not an audit.
Level 2: your source code
For a site you control the code of:
grep -rn "http://" --include="*.php" --include="*.html" --include="*.js" \
--include="*.blade.php" --include="*.twig" resources/ public/ src/
Expect noise: http:// inside comments, http:// in schema.org markup, http://www.w3.org/2000/svg namespaces, URLs that are only ever used as text labels. That noise is worth a moment, because "URL as text" and "URL as a fetch" behave differently; a link displayed to the user is a redirect problem for the visitor, not mixed content, since the browser navigates to it separately.
Level 3: the database (the WordPress case)
On WordPress the bulk of old links lives in wp_posts. The standard query:
SELECT ID, post_title FROM wp_posts
WHERE post_content LIKE '%http://example.com%';
Replacing them has a well-known trap: a naive UPDATE ... REPLACE on serialized PHP data breaks it. Use WP-CLI's search-replace, which understands serialization:
wp search-replace 'http://example.com' 'https://example.com' --all-tables --dry-run
wp search-replace 'http://example.com' 'https://example.com' --all-tables
Run the dry run first and read the counts. If you are not on WordPress, the same idea applies: your CMS's content table is where old embeds live, and LIKE queries find them faster than hope does.
Level 4: crawl the whole site
The only way to be sure nothing is left is to request every page the way a visitor would. A crawler that follows internal links and records every subresource request will catch template-level issues that appear on no page you personally bookmarked:
mcdetect https://example.com
mcdetect is a small open-source crawler (on GitHub, by Agis) built for exactly this: it walks the site, downloads pages over HTTPS, and reports any insecure subresource it sees, page by page. HTTPSChecker (httpschecker.net) does the recursive check with a GUI and also checks every internal link's redirect chain, which covers the cousin problem of your own pages linking to their http:// selves. Neither tool is magic; both just automate what your DevTools session would show if you had all afternoon.
One caution about scanners generally: a crawler sees what a public visitor sees. If parts of your site sit behind a login, the mixed content in your member area will not be found. Those areas need the source and database passes, or a browser session that is logged in.
Fixing what you find
The fixes fall into two groups, and the order matters less than the follow-up: whatever you change, re-run your finder afterwards, because fixes introduce their own leftovers.
Internal resources: change the URL to https:// or go protocol-relative. The cleanest fix for same-origin resources is to drop the scheme and host entirely:
<link rel="stylesheet" href="/css/app.css">
Relative URLs inherit the page's scheme. On an HTTPS page they are fetched over HTTPS, and you can never regress. This is also the fix for the most common root cause in frameworks: a hardcoded http://example.com in a config value that templates print into src attributes. Change the config once, and a hundred pages heal at once.
Third-party resources: upgrade or drop them. For the vendor widget, check whether an HTTPS version exists. If it does not, the resource cannot be used on an HTTPS page without breaking the encryption guarantee, full stop. Host a local copy if the license allows, or drop it. Keeping a cleartext script because "the vendor hasn't updated" keeps a hole in the page.
Content: bulk-replace with care. Follow the Level 3 process: dry run, review counts, then replace. For non-serialized content, a straight REPLACE is fine.
Then there is the safety net. A Content-Security-Policy header with upgrade-insecure-requests asks the browser to rewrite all http:// subresource URLs to https:// before requesting them:
Content-Security-Policy: upgrade-insecure-requests
It is a one-line, near-universally supported mitigation (all major browsers since roughly 2017), and it makes mixed content disappear from view. Two honest caveats. First, it only helps when the HTTPS version of the resource actually exists; if it does not, the request fails, so it is a good stopgap but not a fix. Second, it hides the symptom while the http:// references stay in your markup, so do not let it stop the cleanup. Treat it like HSTS: a hardening layer on top of a fixed site, not a replacement for fixing.
A stricter option for sites that want a tripwire instead of a blanket: a default-src https: policy (see our CSP guide) blocks cleartext resources instead of upgrading them, and with a report endpoint you get a list of violations instead of silence.
What the browser actually does, in one table
| Content type | Chromium behavior today | Firefox behavior | |---|---|---| | scripts, stylesheets, iframes, fetch/XHR, fonts | blocked, console error naming the URL | blocked, console error | | images, audio, video | auto-upgraded to https://; blocked if upgrade fails | passive images: warning only (still loaded over HTTP) |
The table is a snapshot, not a contract. The direction across vendors is the same: less cleartext tolerated every year. If a resource only works over HTTP today, plan for the day it stops working on all of them.
The short version
Mixed content means your encrypted page is fetching some of its parts in the clear. Scripts and styles over HTTP are blocked outright in modern browsers, images get auto-upgraded and fail if they cannot be, and the real damage is usually not the security incident but the silent death of scripts nobody watches. Find it with DevTools for a quick look, your source tree and content database for the real cleanup, and a crawler for the final sweep. Fix internal references at the root (config, not a hundred templates), upgrade or drop third-party cleartext resources, and keep upgrade-insecure-requests as the safety net rather than the plan.
Checking every page of a site you have edited for years is exactly the kind of work tools are better at than memory. CheckWebSecurity reports mixed content findings on every scan, page by page, alongside the other exposure checks it runs. Run a free scan.
Related: Content Security Policy explained in plain terms · HSTS explained in plain terms · Security headers scan