# What does 'Mixed Content: The page was loaded over HTTPS, but requested an insecure resource' mean?

**Short answer:** Your HTTPS page tried to load something over plain `http://`, such as an API URL, script, iframe or image, and the browser blocked or auto-upgraded it. Change the URL to `https://`, usually an env var like `API_URL=http://...`. Add `Content-Security-Policy: upgrade-insecure-requests` as a safety net.

*Last updated 2026-11-25 · Reviewed by ProofForge*

## The exact error

```text
Mixed Content: The page at 'https://app.example.com/' was loaded over HTTPS, but requested an insecure resource 'http://api.example.com/data'. This request has been blocked; the content must be served over HTTPS.
```

## Why it happens

- An env var or hard-coded base URL still says `http://` (often copied from local dev).
- The backend redirects to `http://` because it sits behind a proxy and doesn't trust `X-Forwarded-Proto`.
- Old content (CMS images, embeds) stored with `http://` links.

## How to fix it

1. Search the code and env vars for `http://` and switch to `https://` (or a relative URL).
2. Behind a proxy, trust the proxy so redirects keep `https`. In Express that's `app.set('trust proxy', 1)`.
3. Add the upgrade header for leftover subresources:

```http
Content-Security-Policy: upgrade-insecure-requests
```

## Check it's fixed

Reload with DevTools → Console open. No 'Mixed Content' lines should appear, and the Security panel shows a secure origin.

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## FAQ

### Why is it blocked and not just warned?
Browsers block mixed scripts, fetch/XHR and iframes outright because an attacker on the network could change them. Some images get auto-upgraded instead.

### Is upgrade-insecure-requests enough?
It fixes subresources that also exist on https. Your API must actually serve HTTPS.

### Does it affect SEO?
Indirectly. Broken features and 'Not secure' signals hurt trust. Make sure http:// redirects to https:// too.

## Sources

- [MDN: Mixed content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content)

## Related

- [Fix: missing HTTPS redirect](/fix/missing-https-redirect)
- [Fix: missing security headers](/fix/missing-security-headers)
- [Security headers checker](/tools/security-headers-checker)
- [All errors](/errors)
