Skip to content

fix host/origin header validation in local explorer#12869

Merged
NuroDev merged 4 commits intomainfrom
emily/cdn-cgi
Mar 13, 2026
Merged

fix host/origin header validation in local explorer#12869
NuroDev merged 4 commits intomainfrom
emily/cdn-cgi

Conversation

@emily-shen
Copy link
Copy Markdown
Contributor

@emily-shen emily-shen commented Mar 12, 2026

Previously, we were checking host/origin header in the explorer worker to ensure we only allow same-origin localhost reqs. However, if you have a route set (custom domain etc.), Miniflare does its best to make it look like your local dev is coming from that host, and rewrites headers etc. accordingly. This means we were incorrectly blocking requests as cross-origin when you had a route set - when the local explorer UI makes a request to the local explorer API and the origin and host headers are both my-site.com etc., but our allowed host lists was only localhost.

Also, Wrangler's Proxy miniflare instance (the startDevWorker proxy worker) rewrites headers too, to complicate things.

Basically this PR gets the user routes, adds it to our allowed hosts lists and then everything seems to work.

I've moved the check to the entry worker since we have access to the routes there. I'm only doing this check on explorer routes, because i'm worried this could block some legit usecase i haven't thought of, but if we don't see issues after the local explorer gets use, we could consider moving this to cover all cdn-cgi routes.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: wip experimental feature

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: 223033c

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

✅ All changesets look good

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 12, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12869

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12869

miniflare

npm i https://pkg.pr.new/miniflare@12869

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12869

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12869

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12869

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12869

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12869

wrangler

npm i https://pkg.pr.new/wrangler@12869

commit: c16b6e3

@emily-shen emily-shen marked this pull request as ready for review March 13, 2026 11:21
@emily-shen emily-shen requested a review from a team as a code owner March 13, 2026 11:21
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 13, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@emily-shen emily-shen marked this pull request as draft March 13, 2026 11:28
devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen emily-shen marked this pull request as ready for review March 13, 2026 12:31
devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Mar 13, 2026
@emily-shen emily-shen mentioned this pull request Mar 13, 2026
5 tasks
@NuroDev NuroDev merged commit ade0aed into main Mar 13, 2026
37 of 38 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Mar 13, 2026
@NuroDev NuroDev deleted the emily/cdn-cgi branch March 13, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants