What versions & operating system are you using?
System:
OS: macOS 15.7.3
CPU: (12) arm64 Apple M2 Max
Memory: 1.06 GB / 64.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 25.2.1 - /opt/homebrew/bin/node
npm: 11.6.2 - /opt/homebrew/bin/npm
npmPackages:
@cloudflare/vite-plugin: ^1.35.0 => 1.35.0
@cloudflare/workers-types: ^4.20260430.1 => 4.20260502.1
wrangler: ^4.87.0 => 4.87.0
Please provide a link to a minimal reproduction
No public repro repo yet. Minimal inline repro:
- Create a Worker app using
@cloudflare/vite-plugin
- Set
dev.host in wrangler.jsonc, for example:
- In the Worker, add an endpoint that fetches
https://httpbin.org/headers and returns the response body
- Run
vite dev
- Hit that endpoint
Describe the Bug
vite dev drops the zone value before handing the worker to Miniflare, so outbound subrequests get CF-Worker: <worker-name>.example.com even when dev.host is configured.
In my case this breaks Apple WeatherKit locally because Apple rejects CF-Worker: trmnl.example.com with 403 Forbidden.
I believe this regressed as part of the CF-Worker header support added in PR #12186.
Observed:
- under
vite dev, outbound requests include CF-Worker: <worker-name>.example.com
- WeatherKit returns
403 Forbidden
Expected:
vite dev should propagate the configured host/zone so outbound requests include the configured dev.host (or equivalent route-derived zone), matching wrangler dev --local
What I verified while tracing this:
wrangler dev --local does work once the generated config is current
- under
wrangler dev --local, outbound requests include the configured host in CF-Worker
- under
vite dev, the Vite plugin has the right values before calling Wrangler:
worker.config.dev.host is set
worker.config.routes is set
- inside
wrangler.unstable_getMiniflareWorkerOptions(...), those values are still present on config
- but the returned
workerOptions has no zone, so Miniflare falls back to ${workerName}.example.com
This looks like the drop point:
packages/vite-plugin-cloudflare/src/miniflare-options.ts calls wrangler.unstable_getMiniflareWorkerOptions(...)
packages/wrangler/src/api/integrations/platform/index.ts builds workerOptions but does not include zone
packages/miniflare/src/plugins/core/index.ts then falls back to ${workerName}.example.com
A local workaround that fixes vite dev for me is to inject zone: worker.config.dev?.host into the worker object constructed in packages/vite-plugin-cloudflare/src/miniflare-options.ts after spreading workerOptions.
Please provide any relevant error logs
From a local probe of the outgoing headers under vite dev:
{
"headers": {
"Cf-Worker": "repro.example.com",
"Host": "httpbin.org"
}
}
From the same probe under wrangler dev --local with current generated config:
{
"headers": {
"Cf-Worker": "repro.example.workers.dev",
"Host": "httpbin.org"
}
}
What versions & operating system are you using?
Please provide a link to a minimal reproduction
No public repro repo yet. Minimal inline repro:
@cloudflare/vite-plugindev.hostinwrangler.jsonc, for example:{ "name": "repro", "main": "./src/index.ts", "compatibility_date": "2025-06-17", "dev": { "host": "repro.example.workers.dev" } }https://httpbin.org/headersand returns the response bodyvite devDescribe the Bug
vite devdrops thezonevalue before handing the worker to Miniflare, so outbound subrequests getCF-Worker: <worker-name>.example.comeven whendev.hostis configured.In my case this breaks Apple WeatherKit locally because Apple rejects
CF-Worker: trmnl.example.comwith403 Forbidden.I believe this regressed as part of the CF-Worker header support added in PR #12186.
Observed:
vite dev, outbound requests includeCF-Worker: <worker-name>.example.com403 ForbiddenExpected:
vite devshould propagate the configured host/zone so outbound requests include the configureddev.host(or equivalent route-derived zone), matchingwrangler dev --localWhat I verified while tracing this:
wrangler dev --localdoes work once the generated config is currentwrangler dev --local, outbound requests include the configured host inCF-Workervite dev, the Vite plugin has the right values before calling Wrangler:worker.config.dev.hostis setworker.config.routesis setwrangler.unstable_getMiniflareWorkerOptions(...), those values are still present onconfigworkerOptionshas nozone, so Miniflare falls back to${workerName}.example.comThis looks like the drop point:
packages/vite-plugin-cloudflare/src/miniflare-options.tscallswrangler.unstable_getMiniflareWorkerOptions(...)packages/wrangler/src/api/integrations/platform/index.tsbuildsworkerOptionsbut does not includezonepackages/miniflare/src/plugins/core/index.tsthen falls back to${workerName}.example.comA local workaround that fixes
vite devfor me is to injectzone: worker.config.dev?.hostinto the worker object constructed inpackages/vite-plugin-cloudflare/src/miniflare-options.tsafter spreadingworkerOptions.Please provide any relevant error logs
From a local probe of the outgoing headers under
vite dev:{ "headers": { "Cf-Worker": "repro.example.com", "Host": "httpbin.org" } }From the same probe under
wrangler dev --localwith current generated config:{ "headers": { "Cf-Worker": "repro.example.workers.dev", "Host": "httpbin.org" } }