Skip to content

Conversation

@jamesopstad
Copy link
Contributor

@jamesopstad jamesopstad commented Aug 1, 2025

Fixes #10104.

Ensure that headers set via server.headers in the Vite config are added to HTML asset responses in development.


@jamesopstad jamesopstad requested review from a team as code owners August 1, 2025 09:03
@changeset-bot
Copy link

changeset-bot bot commented Aug 1, 2025

🦋 Changeset detected

Latest commit: 64ccf95

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

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Patch

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-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Aug 1, 2025
@jamesopstad jamesopstad added the vite-plugin Relating to the `@cloudflare/vite-plugin` package label Aug 1, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 1, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 64ccf95

],
bindings: {
CONFIG: assetsConfig,
__VITE_HEADERS__: JSON.stringify(viteDevServer.config.server.headers),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this guaranteed to be defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it gets normalised to an empty object.

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Aug 1, 2025
@jamesopstad jamesopstad merged commit 4e62cd8 into main Aug 1, 2025
38 of 41 checks passed
@jamesopstad jamesopstad deleted the james/vite-server-headers branch August 1, 2025 09:50
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vite-plugin Relating to the `@cloudflare/vite-plugin` package

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Expose Vite server headers in dev mode

2 participants