[fix] force Vite dev mode to use HTTP/1 for TLS
* [fix] force Vite dev mode to use HTTP/1 for TLS
This avoids issues with node-fetch and HTTP/2 Request headers, which was
breaking our `dev --https`.
* add changeset
* only set server.proxy when server.https is present
ADD
.changeset/twelve-comics-enjoy.md
+---
+'@sveltejs/kit': patch
+---
+
+Force Vite to use HTTP/1 in dev mode, so `dev --https` works again

MODIFY
packages/kit/src/core/dev/index.js
packages/kit/src/core/dev/index.js
@@ -85,6 +85,14 @@ export async function dev({ cwd, port, host, https, config }) {
merged_config.server.https = https;
}
+ // by default, when enabling HTTPS in Vite, it also enables HTTP/2
+ // however, node-fetch's Request implementation does not like the HTTP/2 headers
+ // we set a no-op proxy config to force Vite to downgrade to TLS-only
+ // see https://vitejs.dev/config/#server-https
+ if (merged_config.server.https && !merged_config.server.proxy) {
+ merged_config.server.proxy = {};
+ }
+
if (port) {
merged_config.server.port = port;
}

[fix] force Vite dev mode to use HTTP/1 for TLS (#3553)

* [fix] force Vite dev mode to use HTTP/1 for TLS

This avoids issues with node-fetch and HTTP/2 Request headers, which was
breaking our `dev --https`.

* add changeset

* only set server.proxy when server.https is present