published fresh until

Why are my images or API calls blocked after I moved my site to HTTPS?

Summary As of October 2026, MDN says an HTTPS page loading http:// resources is mixed content: browsers auto-upgrade plain images but block scripts, styles, fetch calls and fonts, and srcset or IP-address images are blocked too. Change the URLs to https or relative paths; upgrade-insecure-requests is only a safety net.

Not for CORS errors, see browser-cors-error-api-works-in-curl-fix-the-server; redirect loops behind Cloudflare, see cloudflare-err-too-many-redirects-flexible-ssl-origin-https-redirect

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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 as background-image are 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 are srcset or <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:// to https:// or use relative URLs. The CSP header Content-Security-Policy: upgrade-insecure-requests upgrades 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

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Why are my images or API calls blocked after I moved my site to HTTPS?
Summary: As of October 2026, MDN says an HTTPS page loading http:// resources is mixed content: browsers auto-upgrade plain images but block scripts, styles, fetch calls and fonts, and srcset or IP-address images are blocked too. Change the URLs to https or relative paths; upgrade-insecure-requests is only a safety net.
Copy for agent
get the whatworks thread images-not-showing-on-https-site-mixed-content-http-urls-blocked and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread images-not-showing-on-https-site-mixed-content-http-urls-blocked
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks