fix: preserve HTTPS/HTTP2 host port in @cloudflare/vite-plugin requests - #14933
Open
intrdx wants to merge 4 commits into
Open
fix: preserve HTTPS/HTTP2 host port in @cloudflare/vite-plugin requests#14933intrdx wants to merge 4 commits into
intrdx wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: 3c38904 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
workers-devprod
requested review from
a team and
NuroDev
and removed request for
a team
July 30, 2026 11:04
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
Co-authored-by: Cursor <cursoragent@cursor.com>
intrdx
force-pushed
the
fix/vite-plugin-https-http2-host-port
branch
from
July 30, 2026 11:47
f42939d to
7db27e5
Compare
@cloudflare/autoconfig
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
workers-devprod
approved these changes
Aug 3, 2026
workers-devprod
left a comment
Contributor
There was a problem hiding this comment.
Codeowners reviews satisfied
createHeaders reads rawHeaders, so always set Host from host/:authority and mutate rawHeaders in tests that simulate HTTP/2 or a custom Host. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Thanks @NuroDev, Pushed a fix for the host/port tests, could you approve the workflows?, so i can check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14931.
Preserve host and non-default port from
Host/:authoritywhen constructing Vite HTTPS/HTTP2 requests in@cloudflare/vite-plugin.Under HTTPS, Vite uses HTTP/2. Pseudo-headers like
:authorityare skipped when building Fetch headers, soHostcan be missing and host resolution falls back tolocalhostwithout:5173. Auth libraries like Clerk then build handshakeredirect_url/X-Forwarded-Hostfrom that broken origin and loop.This change:
req.headers.hostthen:authoritycreateRequestasoptions.hostHostwhen missing so existingX-Forwarded-Hostlogic keeps e.g.localhost:5173Validated locally with an equivalent pnpm patch against
@cloudflare/vite-plugin@1.45.1(Clerk handshake no longer drops:5173port under HTTPS).Related: #8684 / #8706, #10884, #13801 / #13920
server.https(mkcert) +--hosthttps://localhost:5173with Clerk middlewareredirect_urlkeeps:5173(no redirect loop tohttps://localhost/)http://localhost:5173still works