Skip to content
Hookgap

Mixed content warnings: what they mean and how to fix them

· 5 min read

A site can have a valid certificate and still show a broken or missing padlock. The usual cause is mixed content: the page itself loads over HTTPS, but something on it, often an old image or embed, still loads over http://. It is common after a site moves to HTTPS, and it is usually quick to fix.

Active vs passive mixed content

TypeExamplesWhat browsers do
ActiveScripts, stylesheets, iframes, fonts, fetch requestsBlock it. Parts of the page may break.
Passive (display)Images, audio, videoTry to upgrade to HTTPS automatically; block it if the HTTPS version fails.

Active mixed content is the one to fix first. A script loaded over HTTP can be replaced in transit, and a replaced script controls the page. Hookgap reports active and passive mixed content as separate findings for that reason.

Finding it

  1. Open the page, then the browser's developer tools (F12), then the Console. Browsers log each mixed content request.
  2. View the page source and search for http:// in src= and href= attributes on scripts, stylesheets and images.
  3. Check templates and theme settings, not only page content: logos, background images and footer embeds are frequent culprits.

Fixing it on WordPress

  1. Settings → General: make sure both the WordPress Address and Site Address start with https://.
  2. Replace old URLs in the database. With WP-CLI: wp search-replace 'http://example.com' 'https://example.com' --dry-run, check the counts, then run it without --dry-run. Back up first. A well-known search-and-replace plugin does the same job.
  3. Check the theme and page builder for hard-coded http:// asset URLs.
  4. Update or replace embeds from third parties that only offer HTTP.

Fixing it elsewhere

  • Static and custom sites: search the codebase for http:// and switch to https:// or a relative path.
  • A safety net: the CSP directive upgrade-insecure-requests tells browsers to fetch every resource over HTTPS. It is useful while you clean up, but it does not fix resources that do not exist over HTTPS.
  • Cloudflare has an "Automatic HTTPS Rewrites" setting that rewrites many links on the fly.

Then lock in HTTPS

Once the page is clean, add HSTS so browsers never load the site over HTTP again. Website security headers explained covers HSTS and the other headers in a safe order. A free Hookgap check shows whether mixed content is still present on the homepage, alongside the certificate and headers.

Frequently asked questions

What is mixed content?

Mixed content is an HTTPS page that loads some resources, such as images, scripts or stylesheets, over plain HTTP. Those resources travel unencrypted and can be read or changed in transit.

Is mixed content dangerous?

Active mixed content (scripts, stylesheets, iframes) is the serious kind, because whoever alters it can change the whole page; browsers block it. Passive mixed content such as images is lower risk, and modern browsers try to upgrade it to HTTPS automatically.

How do I find mixed content on a page?

Open the browser's developer tools and look at the Console: browsers log every mixed content request they block or upgrade. Searching the page source for "http://" also finds most of it.

More on website security