1. Passive vs. Active Mixed Content: Threat Profiles & Browser Handling

Browsers classify mixed content into two distinct risk categories based on whether the insecure subresource can alter the Document Object Model (DOM) of the parent page:
Active Mixed Content (Critical Risk): Occurs when the browser loads executable resources - such as JavaScript files (<script src='http://...'>), CSS stylesheets (<link rel='stylesheet'>), iframes, XMLHttpRequest, or WebSocket connections - over unencrypted HTTP. An attacker on the local network (such as a public Wi-Fi hotspot) can intercept the cleartext HTTP traffic and replace the script with malicious code. The injected script inherits full access to the HTTPS page's DOM, allowing the attacker to capture keystrokes, harvest login passwords, and steal session tokens. Because of this extreme risk, modern browsers block active mixed content automatically.
Passive Mixed Content (Moderate Risk): Involves non-executable media files - such as images (<img src='http://...'>), audio files, and video streams. While an attacker cannot directly execute JavaScript through an image file, they can swap image content to display misleading financial information or phish users. In addition, an eavesdropper can track which images a user loads to reconstruct their browsing activity. Modern browsers strip the security padlock or attempt automatic HTTPS upgrades. Verify your SSL certificate installation with our Free SSL Checker Tool.
| Category | Resource Types | Security Risk | Modern Browser Behavior |
|---|---|---|---|
| Active Mixed Content | <script src>, <link rel='stylesheet'>, <iframe>, fetch(), XMLHttpRequest | Critical: Attacker can intercept HTTP and inject malicious JS to steal cookies or redirect users | Blocked automatically by default in all modern browsers; throws console errors |
| Passive Mixed Content | <img>, <audio>, <video>, <source> | Moderate: Attacker can swap images or monitor user viewing habits via cleartext traffic | Browsers attempt auto-upgrading to HTTPS; if upgrade fails, resource may be blocked or padlock removed |
2. Instant Mass Remediation: The CSP upgrade-insecure-requests Header

Migrating enterprise websites with thousands of legacy articles and hardcoded database URLs to HTTPS can be time-consuming. Fortunately, the W3C Content Security Policy specification provides an elegant mechanism for instant, zero-downtime remediation: the `upgrade-insecure-requests` directive.
When you publish the Content-Security-Policy: upgrade-insecure-requests HTTP response header, modern browsers automatically rewrite all insecure http:// subresource URLs to https:// before initiating network requests. A legacy tag like <img src="http://cdn.example.com/logo.png"> is transparently requested over https://cdn.example.com/logo.png, eliminating browser mixed content warnings without requiring manual database find-and-replace scripts.
In addition to CSP, deploy the HTTP Strict Transport Security (HSTS) header (Strict-Transport-Security: max-age=31536000; includeSubDomains; preload). HSTS ensures that browsers automatically upgrade all future top-level and subdomain requests to HTTPS, preventing SSL-stripping attacks. Audit your server headers with the WeSecureX Security Headers Checker.
# Deploying CSP upgrade-insecure-requests in Nginx
server {
listen 443 ssl http2;
server_name example.com;
# Enforce automatic HTTPS rewriting for all subresources
add_header Content-Security-Policy "upgrade-insecure-requests;" always;
# Enforce HSTS for 1 year including subdomains
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
}
# Deploying in Apache (.htaccess)
<IfModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>3. Permanent Resolution: Database & Source Code Auditing

While upgrade-insecure-requests resolves mixed content on modern browsers, it is a client-side patch. If a third-party asset provider does not support HTTPS, the upgraded request will fail with an SSL handshake error, resulting in broken images or failed scripts. A robust security strategy requires permanent remediation in application templates and databases.
Audit your CMS databases (WordPress, Ghost, Drupal) for hardcoded http:// URLs. Execute SQL updates to replace hardcoded protocol prefixes with relative paths (e.g., /images/logo.png) or explicit https:// links. In your source code repositories, search for hardcoded http:// asset imports in JSX, HTML, and CSS bundles.
Verify that your continuous integration pipelines audit all new pull requests for insecure asset URLs. Use the WeSecureX Technical SEO Scanner to crawl your entire domain and detect mixed content links, broken SSL certificates, and insecure redirects before your users encounter browser warnings.
-- SQL Query to audit and clean hardcoded HTTP links in database tables
-- 1. Identify posts containing legacy http links
SELECT id, title FROM blog_posts WHERE content LIKE '%http://static.example.com%';
-- 2. Bulk replace legacy HTTP URLs with HTTPS
UPDATE blog_posts
SET content = REPLACE(content, 'http://static.example.com', 'https://static.example.com')
WHERE content LIKE '%http://static.example.com%';
-- 3. Replace third-party HTTP widgets with HTTPS
UPDATE blog_posts
SET content = REPLACE(content, 'http://widgets.provider.com', 'https://widgets.provider.com')
WHERE content LIKE '%http://widgets.provider.com%';Apply it with WeSecureX
Add a hostname you own or are allowed to test, run a scan, and open the findings for that target. A confirmed result includes the request WeSecureX sent and the response the site returned, so you can reproduce it, fix it in your own application, and rescan the same host to confirm the issue is gone. WeSecureX is automated testing, not a manual penetration test, and a clean report is not a promise that every weakness is gone.
WeSecureX modules for this topic
Checks that belong with this topic
- Deploy the Content-Security-Policy: upgrade-insecure-requests header across your web server.
- Replace hardcoded http:// protocol prefixes with root-relative paths (/path/to/asset).
- Audit third-party widget, font, and analytics providers to confirm HTTPS support.
- Validate SSL certificate installation and expiration using the WeSecureX SSL Checker.
- Check your site with the WeSecureX Security Headers Checker to confirm HSTS and CSP.
Actionable Checklist
WeSecureX Platform · Surface Monitor
Application Attack Surface Analyzer
Inspect open ports, TLS certificate chains, HTTP headers, and API endpoint security posture.
Includes: TLS/SSL cipher suite & expiration monitoring · Security header verification (CSP, HSTS) · Subdomain asset discovery
Frequently Asked Questions
If the third-party server hosting the resource does not have an active SSL/TLS certificate, the browser's upgraded HTTPS request will fail with an SSL handshake error (`ERR_CERT_COMMON_NAME_INVALID` or `ERR_CONNECTION_REFUSED`), and the asset will not load.
HSTS fixes mixed content *only* for the domain and subdomains covered by the HSTS policy (`includeSubDomains`). It does not upgrade third-party external resources (e.g., external CDNs) loaded over cleartext HTTP unless `upgrade-insecure-requests` is also present.
The [WeSecureX Technical SEO Scanner](/seo-scanner) and [Website Scanner](/scanner) crawl your internal pages and flag all unencrypted HTTP subresources and insecure redirects.
Authoritative Sources & References
- Google Web Fundamentals: Preventing Mixed ContentGoogle (official)View Source
- W3C Mixed Content SpecificationW3C (official)View Source
Related Guides
Continue exploring related technical architecture and defensive guides
CSRF · cookies
Cross-Site Request Forgery (CSRF): SameSite Cookies & Anti-CSRF Token Defense
Learn how to completely prevent Cross-Site Request Forgery (CSRF) vulnerabilities using modern browser security primitives, SameSite cookies, and cryptographically secure tokens.
JWT · authentication
JSON Web Token (JWT) Security: Vulnerabilities, Storage & Implementation Guide
A developer's guide to building secure JWT authentication workflows, eliminating critical signature bypasses, and safeguarding tokens from client-side theft.
subdomain takeover · DNS security
Subdomain Takeover: Detection, Exploitation & Prevention Guide
A developer and DevOps guide to discovering and eliminating dangling DNS records and preventing high-severity subdomain takeover exploits across cloud infrastructure.