---
title: "Reproduce on the same kind of origin: file://, localhost or a network address | Proofline"
description: "A reproduction that behaves differently on the maintainer's machine may be running on a different kind of origin."
url: https://proofline.sh/learn/localhost-file-origin-repro/
---

[Learning center](/learn/)

# Reproduce on the same kind of origin: file://, localhost or a network address

A reproduction that behaves differently on the maintainer's machine may be running on a different kind of origin. The same HTML file opened from disk, from http://localhost and from http://192.168.1.20 gets different permissions from the browser. Some APIs are missing, module scripts refuse to load, and some request headers are never sent. Pick the origin type that matches the reporter's.

Permission errors The Proofline team November 22, 2026 3 min read

## Three origins, tested

We loaded the same pages in Chromium from a file on disk, from `http://localhost` and `http://127.0.0.1`, and from the machine's network address over `http`, and checked what they could do:

|  | File | Localhost | Network address |
| --- | --- | --- | --- |
| `isSecureContext` | `true` | `true` | `false` |
| `crypto.subtle` | available | available | `undefined` |
| `self.origin` | `"null"` | The page's origin | The page's origin |
| `<script type="module" src="./m.js">` | Blocked by CORS: "Cross origin requests are only supported for protocol schemes: … http, https" | Loads | Loads |
| `fetch('./m.js')` | Fails: "URL scheme "file" is not supported" | Works | Works |
| `Sec-CH-UA` request headers | Not applicable | Sent | Not sent |

Browsers treat `localhost` and loopback addresses as potentially trustworthy, so they get secure-context features without HTTPS. Any other plain `http` address does not. [MDN: Secure contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)

## What breaks on each

**`file://`.** Module scripts, `fetch` of neighboring files, and anything that needs a real origin, such as cookies scoped to a host, OAuth redirects or a service worker. The page's origin is opaque, reported as `"null"`, so storage and messaging behave differently too. A single-file reproduction that uses only inline scripts may still work, which makes the failure confusing when you add one module.

**A LAN or internal address over `http`.** Features restricted to secure contexts are missing: the Web Crypto API's `subtle`, service workers, the Clipboard API's read and write, geolocation, client hints, and others. A tester on a phone pointed at a developer's laptop by IP address hits this, while the developer on `localhost` does not.

**`localhost`.** Mostly behaves like production over HTTPS, with exceptions. Cookies marked `Secure` and set over `http://localhost` are accepted by Chromium, which a production site on a plain `http` host would not get. Cookies set for `localhost` also have unusual domain rules.

## Pick the right origin for a reproduction

| Reporter was on | Reproduce on |
| --- | --- |
| A production site over HTTPS | `http://localhost` for most bugs, or a local HTTPS setup when cookies, redirects or third parties matter |
| A device on the local network, reaching a dev server by IP | The same network address over plain `http`, from that device or another machine; not `localhost`, and not an HTTPS tunnel, which turns the missing APIs back on. HTTPS is the fix, not the reproduction. |
| A file opened from disk, such as an exported report | `file://`, deliberately |

To serve a single-file reproduction over `http://localhost`, any static server works, such as `npx serve` or `python3 -m http.server` in its directory.

## Worked example: encryption that failed on a phone

This example is fictional. A developer builds a notes app that encrypts drafts in the browser. A tester on a phone, opening the dev server at `http://192.168.1.20:5173`, reports a blank screen. On the developer's laptop at `http://localhost:5173` everything works.

The phone's console, read through remote debugging, shows `TypeError: Cannot read properties of undefined (reading 'importKey')`. Over a plain `http` network address, `crypto.subtle` is undefined. The developer reproduced it on the laptop by opening the network address instead of `localhost`, then gave the dev server an HTTPS certificate for testing on devices, and added a clear error for insecure contexts.

## Questions

### Is `127.0.0.1` the same as `localhost`?

Both are treated as potentially trustworthy, but they are different origins and different sites. Cookies and storage set on one are not visible on the other. A reproduction that switches between them loses its state.

### Can I make a network address a secure context?

Serve it over HTTPS with a certificate the device trusts, or use Chrome's flag for treating a specific insecure origin as secure while testing. Record which you used.

### Does Firefox treat `file://` the same way?

Firefox also restricts what `file://` pages can load, with its own rules. Serve reproductions over `http://localhost` to avoid the question.

Return to [reproducing what someone else saw](/learn/replay-browser-bug-report/) for the other layers a replay needs.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Cut a reproduction down to one page](/learn/minimal-reproduction/)
    
    Broken dependencies The Proofline team November 22, 2026 3 min read
    
-   ### [Login succeeds, then the next request is anonymous: trace the cookie](/learn/cookie-not-sent-after-login/)
    
    Permission errors The Proofline team November 20, 2026 4 min read
