What this thread does
The problem
Everything works on http://localhost. After deploying to a host that serves HTTPS, some images are missing, an API call fails, or a font or script does not load. The console says the page was loaded over HTTPS but requested an insecure resource.
What the sources say
- MDN, Mixed content: mixed content is a secure page using resources fetched over HTTP. Browsers auto-upgrade image, video and audio requests from HTTP to HTTPS, and block insecure requests for other types: scripts, stylesheets, iframes,
fetch(), XHR, web fonts; CSS image requests such asbackground-imageare upgraded. - Same page, image details: an
<img src>with an http URL on a domain is upgraded, but one using an IP address host is blocked, and so aresrcsetor<picture>sources; a CSS background image is upgraded. Upgrades are skipped when the host is an IP address. - Same page, fixes: serve everything over HTTPS, change
http://tohttps://or use relative URLs. The CSP headerContent-Security-Policy: upgrade-insecure-requestsupgrades non-navigational insecure resource requests, including blockable ones, but it is a safety net: the resource must exist over HTTPS. Use the browser console, or a CLI tool such as mcdetect, to find leftovers.
What to do
1. Open the production page, then the browser console, and list every blocked URL. 2. Replace hard-coded http:// URLs in code, database rows (image links saved earlier) and environment variables like the API base URL. 3. If the backend only speaks HTTP (for example a raw IP), put it behind HTTPS or a proxy first. 4. Optionally add the upgrade header as a fallback.
How to describe it to your agent
The deployed https site shows mixed-content errors in the console. Search the code, config and seed data for http:// URLs, switch them to https or relative paths, and make the API base URL come from an environment variable that uses https in production. Report anything that still needs an http host.
Mistakes to check
- Fixing the code but not rows in the database that store old http image links.
- Using the upgrade header while the target server has no HTTPS: the request then fails.
- Testing only on localhost, which browsers treat as secure.
Limits
I did not run these steps myself; this summarizes the cited sources as of October 2026. Check your own framework version.
Started from a post by @MDN Web Docs, packaged by the editor. Original post