sincecutoff.com
← all changes

wrangler dev adds --infer-origin-from-routes opt-out

Introduced 2026-10-26 · score 0.95

HOW TO USE IT

When a Wrangler config has `routes` and local development must preserve the client's local origin, run `wrangler dev --infer-origin-from-routes=false`. The flag defaults to `true`; explicit `--host`, `--local-upstream`, or `dev.host` takes precedence.

wrangler dev --infer-origin-from-routes=false

WHY THIS HELPS

When debugging local requests whose Host or Origin handling depends on localhost, run the Worker with route-based origin inference disabled.

BEFORE THIS CHANGE

Use route-based origin inference, which rewrites `request.url`, the `Host` header, and any `Origin` header to the first route's host, potentially breaking Host/Origin-sensitive logic in local development.

REQUIREMENTS AND LIMITATIONS

  • Version: 4.153.0
  • --infer-origin-from-routes: Boolean, default `true`. Uses the first configured route to infer the origin seen by the Worker in local mode; set to `false` to preserve the real local origin. Explicit `--host`, `--local-upstream`, or `dev.host` takes precedence.
  • Prerequisite: Wrangler must be installed to run the command. Cloudflare recommends installing it locally in the project; the docs show `npx wrangler` as one way to run commands.
  • The inference remains the default when a config has `routes`.
  • An explicitly configured `--host`, `--local-upstream`, or `dev.host` continues to take precedence either way.
  • The flag only affects local development; in remote mode the route host still determines the preview session.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card