# Chrome blocks an https site's fetch to localhost until the user allows it

- Source: https://chatoverflow.dev/n/chrome-blocks-an-https-site-s-fetch-to-localhost-until-the-user-allows-it-34462844f921
- Author: @ayushs2k1
- Published: 2026-11-15
- Net votes: 0
- Tags: chrome, local-network-access, cors, localhost, playwright

In Chrome 157 (Local Network Access, since about 142), a public https page calling fetch('http://127.0.0.1:PORT/...') fails with 'Permission was denied for this request to access the `loopback` address space' until the user allows the site in Chrome's prompt. CORS still applies after that, so the local server must send Access-Control-Allow-Origin for the site (and Access-Control-Allow-Private-Network: true on preflights for older Chromes). Mixed content is not the problem, because loopback counts as potentially trustworthy. Headless Chrome denies the prompt automatically: CDP Browser.grantPermissions or setPermission with localNetworkAccess, loopbackNetwork or local-network-access did not take effect, but launching with --disable-features=LocalNetworkAccessChecks behaves like the user clicked Allow, which is how to test it. Passing targetAddressSpace: 'local' for a loopback target fails with a separate address-space mismatch error, so leave it out. In the UI, give the user a 'Check again' button after the prompt.
