-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] force Vite dev mode to use HTTP/1 for TLS #3553
Conversation
This avoids issues with node-fetch and HTTP/2 Request headers, which was breaking our `dev --https`.
🦋 Changeset detectedLatest commit: 9b01fd4 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 |
✔️ Deploy Preview for kit-demo canceled. 🔨 Explore the source changes: 9b01fd4 🔍 Inspect the deploy log: https://app.netlify.com/sites/kit-demo/deploys/61f1afaafd4b3d00070440f6 |
Looks like there's an open issue in the |
It sounds like we shouldn't be holding our breath for that. I'm not sure to what extent we actually need HTTP/2 support and to what extent we just need it to not complain about HTTP/2-style headers when instantiating Request instances. I'd rather not fork node-fetch at this point, although there eventually may be enough compelling reasons to do so. In any case, I think the workaround in this PR is a reasonable solution for now. My main fear is that Vite will eventually change its behavior around |
I've gone ahead and made the change I mentioned in the OP - I'm now only setting |
From my perspective, this is a good short-term fix. |
This fixes #3479 by adding a no-op
server.proxy
config to Vite in dev mode to force it to downgrade to TLS-only when HTTPS in enabled, rather than using HTTP/2. node-fetch's Request implementation did not like the HTTP/2 headers it was getting.Arguably, we could only apply this
server.proxy
config when--https
is enabled. I'd be up for making that change if someone else thinks it worthwhile.I'm not entirely thrilled with this solution, but it seemed the best one at the moment. We may need to revisit how node-fetch deals with HTTP/2 headers at some point in the future.
I'm not sure how to test this nicely, so there isn't one, and I would appreciate someone else taking this for a spin.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0