How to Fix Mixed Content HTTP/HTTPS Error (Beginner-Friendly Guide)
# Step 1 — Understand Mixed Content
-
HTTPS page → secure
-
HTTP resource → insecure
-
Browser blocks insecure requests → Mixed Content error
-
Example error in browser console:
-
Two types:
-
Passive content (images, videos, audio) → sometimes displayed but not secure
-
Active content (JS, CSS, iframes) → blocked by default
-
## Step 2 — Check Browser Console
-
Open developer tools (F12) → Console
-
Look for:
-
Mixed Contentwarnings/errors -
HTTP URLs that need fixing
-
## Step 3 — Use HTTPS for All Resources
-
Change URLs from
http://tohttps://in:-
HTML
<img>tags -
CSS
url()references -
JavaScript imports
-
AJAX or fetch calls
-
Example:
## Step 4 — Use Relative or Protocol-Relative URLs
-
Relative URL → browser uses the current protocol:
-
Protocol-relative URL (less common now, but works):
## Step 5 — Redirect HTTP to HTTPS on Server
-
Ensure all HTTP requests are redirected to HTTPS
Nginx Example
Apache Example (.htaccess)
## Step 6 — Update CMS or External Libraries
-
WordPress, Joomla, etc. → update URLs in settings
-
Plugins and themes → ensure HTTPS URLs
-
Third-party scripts (like Google Fonts, Ads, or APIs) → use HTTPS versions
## Step 7 — Check AJAX and API Calls
-
Fetch requests must use HTTPS if the site is HTTPS:
-
Otherwise, browser will block the request
## Step 8 — Test with Online Tools
-
Use tools to scan your website:
-
These identify mixed content sources you may have missed
## Step 9 — Clear Cache
-
Clear browser cache
-
Clear CDN or server cache if using caching
-
Reload site → confirm errors are gone
## Step 10 — Beginner-Friendly Checklist
| Problem | Diagnosis | Fix |
|---|---|---|
| Images blocked | Browser console | Change HTTP → HTTPS or use relative URLs |
| JS/CSS blocked | Console error | Change resource URLs to HTTPS |
| AJAX/API blocked | Network tab | Use HTTPS endpoint |
| CMS content | Links still HTTP | Update settings or database references |
| Server not redirecting | Test HTTP URL | Add 301 redirect to HTTPS |
| Third-party scripts | Console warnings | Use HTTPS version of scripts |
## Conclusion
Mixed Content errors are common when migrating to HTTPS or integrating external resources. Beginners can fix them by:
-
Using HTTPS URLs for all resources
-
Using relative URLs where possible
-
Redirecting HTTP to HTTPS on the server
-
Updating CMS and third-party resources
-
Testing with browser console and online tools
Fixing mixed content improves website security, user trust, and avoids broken resources.