Skip to main content

Security fix

How to Fix Mixed Content Warnings

Make every resource load over HTTPS so the browser shows a secure padlock.

Last updated by the SlapMyWeb team

Difficulty
Easy
Impact
High
Time
20 min

Before

<img src="http://example.com/logo.png">  <!-- blocked on https page -->

After

<img src="https://example.com/logo.png">
<!-- header: Content-Security-Policy: upgrade-insecure-requests -->
Before and after code for: How to Fix Mixed Content Warnings

Mixed content means an HTTPS page loads images, scripts or styles over plain HTTP. Browsers block or flag those files, which breaks the padlock and sometimes the layout. Find the insecure URLs in the browser console, change them to HTTPS, and add an upgrade-insecure-requests directive to catch any you missed.

Why it matters

Mixed content happens when an HTTPS page loads images, scripts or styles over insecure HTTP. Browsers block or warn about it, breaking the padlock and sometimes the page. It defeats the purpose of having HTTPS.

How to fix it

  1. Find the HTTP resources

    Open DevTools → Console; mixed-content warnings list every http:// resource on the page.
  2. Switch them to HTTPS

    Update the URLs to https:// (or protocol-relative). Re-upload any assets only available over HTTP.
  3. Add an upgrade directive

    As a safety net, send upgrade-insecure-requests so browsers auto-upgrade subresource requests.

The code

Beforehtml
<img src="http://example.com/logo.png">  <!-- blocked on https page -->
Afterhtml
<img src="https://example.com/logo.png">
<!-- header: Content-Security-Policy: upgrade-insecure-requests -->

On your platform

WordPress

"Really Simple SSL" rewrites insecure URLs automatically; for hardcoded ones, run a search-replace on the database.

Next.js

Use https:// (or relative) asset URLs; next/image requires configured https domains.

Sources

Check your site with our free tool

SSL Certificate Checker

Fixed that one.
Now find the rest.

A free audit puts every issue on your site into a fix plan, most urgent first, and links each one to its guide.

Run a free audit
First audit freeNo card neededLive scan progress