Skip to content

Troubleshooting guide

Mixed content errors: how to find and fix them

Mixed content means an HTTPS page tried to load something over plain HTTP. Browsers block scripts outright and upgrade or warn for images.

3 min read9 sectionsUpdated

On this page

Key points

  • Active content such as scripts is blocked, so features break silently.
  • Hardcoded http:// URLs in a CMS database are the usual source.
  • upgrade-insecure-requests is a good safety net, not a full fix.
  • The console names every offending URL.

What mixed content is

An encrypted page that pulls in unencrypted resources undermines its own protection, since an attacker could alter the script in transit. Browsers therefore block active content such as scripts, iframes and stylesheets. Images, audio and video are upgraded to HTTPS automatically where possible, and blocked if that fails.

Common causes

  • Absolute http:// links saved in CMS content before the site moved to HTTPS.
  • Third-party widgets that use old embed code.
  • API base URLs set to HTTP in environment variables.
  • A proxy that hides HTTPS from the app, so the app generates HTTP links because it believes it is on HTTP.

Diagnose it

Open DevTools, then the Console, and filter by "Mixed Content". Every blocked resource is listed with its URL. To scan the HTML of a page from the command line:

bash
# http:// references in src or href
curl -s https://example.com/ | grep -oE '(src|href)="http://[^"]+' | sort -u

# WordPress: count stored http links (requires WP-CLI)
wp db query "SELECT COUNT(*) FROM wp_posts WHERE post_content LIKE '%http://example.com%'"

# Does the app know it is behind TLS?
curl -sI https://example.com/ | grep -i location

Fixes

Replace the URLs at the source. On WordPress, run wp search-replace 'http://example.com' 'https://example.com' after a backup. Update API URLs in configuration. Pass X-Forwarded-Proto from the proxy so the application generates HTTPS links. Then add this response header as a safety net:

Content-Security-Policy: upgrade-insecure-requests

Finally, enable HSTS once everything works over HTTPS.

Catch it automatically

Blocked scripts rarely return an error status, so a normal uptime check will not see them. Real-user monitoring catches the resulting JavaScript errors in actual browsers, and a browser check can fail when a key element does not appear on the page.

Frequently asked questions

Does mixed content hurt SEO?

Indirectly. Google prefers secure pages, and broken scripts or images damage user experience, which matters more than the warning.

Is upgrade-insecure-requests enough?

It fixes most cases, but only if the resource is available over HTTPS. Fix the source URLs as well.

Why is an image blocked when others load?

The browser tried to upgrade it to HTTPS, and that server does not offer it.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.