Skip to content
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

6.0.0-beta.10 regression, https server lost http2 support (back to http1.1) #18786

Closed
7 tasks done
sai-cb opened this issue Nov 26, 2024 · 6 comments · Fixed by #18788
Closed
7 tasks done

6.0.0-beta.10 regression, https server lost http2 support (back to http1.1) #18786

sai-cb opened this issue Nov 26, 2024 · 6 comments · Fixed by #18788
Labels
p4-important Violate documented behavior or significantly improves performance (priority) regression The issue only appears after a new release

Comments

@sai-cb
Copy link

sai-cb commented Nov 26, 2024

Describe the bug

Starting with the 6.0.0-beta.10 release (inclusive of the stable v6.0.0 release), using server.https in the Vite config no longer enables http2 as the doc indicates:

https://vite.dev/config/server-options#server-https

Enable TLS + HTTP/2.

Instead, all assets are served over http1.1. This can slow down loading assets from the dev server for complex project with lots of modules using https, but this is also critical as it breaks streaming support through custom dev server reverse proxy plugins (http1.1 does not support more than a few concurrent streaming connections)

Reproduction

https://stackblitz.com/edit/vitejs-vite-1lmesq?file=vite.config.ts

Steps to reproduce

Here's a vite.config.ts configuration with a self-signed certificate to reproduce this case:

import { defineConfig } from 'vite';

const HTTPS_CERTIFICATE = `-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCg0s4NlnbrpWWO
tpEMgWJaKYY3dNO4vfbxEhifXMeIYXRjY1WMXJFi5SWkZ4V8Y9476nUKHfyE1Jy/
IkI0lHUcSyP9Zd1mPdObJUOXdWgCSnRduAsxpeLjhdcCsdXNnXm6TRhqgQGBTMaR
UQSh3An0mFx2tMnjOAGBw6wqkcDkEuvW3WZPHnCUT0UrWqcgh3xJBU0C7cjrnVXQ
YJZmxnMyi/89CNjwvWpEbq3hNUMkoeNmBclA4a0PMG7eDASWa4ZA0Yz9owqzKJjN
2dAFYidr6hHZsWhWp0kL1nMbQ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0DEQKKnqIqu/B9RaJsxnKe+QbrzHaxkdD
vRWkHDb6SGuUKx+iRPvM3as6mi+gDd27emCxfK7GyVTOmO/NHk1bOU4eI9hfBHvc
ucULWyXMwhsGNTH+owVnK9J/AhxFrPrLBBhBvsmvFyGniRrzsmkBf/1HY7brMGFo
u1cutX+vJ04Si4/VRrejifQ97X+2z4TWTowRFVHSjZ5PwIaSNSZpW8b5dQu1krES
CdcgOPhaVc92LHWWRg==
-----END CERTIFICATE-----

`;

export default defineConfig(() => {
  return {
    server: {
      port: 4000,
      https: {
        cert: HTTPS_CERTIFICATE,
        key: HTTPS_CERTIFICATE,
      },
    },
  };
});

  1. Save the above in vite.config.ts
  2. Run npm install, npm run dev
  3. Go to https://localhost:4000/
  4. Dismiss the error about the self signed certificate (click "Advanced" and "Proceed to localhost")
  5. Open Chrome dev tools to check if assets are served with h2 (http2) or http1.1

System Info

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 1.55 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    Yarn: 4.1.0 - ~/.nvm/versions/node/v22.11.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    Watchman: 2024.11.04.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 131.0.6778.86
    Firefox: 128.0
    Safari: 18.1.1
  npmPackages:
    vite: ^6.0.0 => 6.0.0

Used Package Manager

npm

Logs

No response

Validations

@sai-cb
Copy link
Author

sai-cb commented Nov 26, 2024

Before (v5)

Screenshot 2024-11-26 at 11 28 20 AM

After (v6)

Screenshot 2024-11-26 at 11 28 59 AM

@sai-cb sai-cb changed the title 6.0.0 regression, https server lost http2 support (back to http1.1) 6.0.0-beta.10 regression, https server lost http2 support (back to http1.1) Nov 26, 2024
@sai-cb
Copy link
Author

sai-cb commented Nov 26, 2024

Updated description and title; This got introduced in 6.0.0-beta.10 and is affecting the stable release.

The 6.0.0-beta.9 release does not seem to include the regression.

@bluwy bluwy added the regression The issue only appears after a new release label Nov 26, 2024
@userquin
Copy link
Contributor

Looks like proxy object is empty, we should check with some entry:

imagen

@userquin
Copy link
Contributor

userquin commented Nov 26, 2024

proxy should be removed from default server options or check if it has some entry when creating the server, regression here https://github.com/vitejs/vite/pull/18550/files#diff-abb3345b6e3b2ec6d297c2ebc54cca85ae4487a31bac3cc9e78457f5114adb26R1026

@bluwy
Copy link
Member

bluwy commented Nov 26, 2024

It should be set as undefined by default I believe. Setting an object has intentionally another meaning (regardless of properties) iirc.

@bluwy bluwy added p4-important Violate documented behavior or significantly improves performance (priority) and removed pending triage labels Nov 26, 2024
@sai-cb
Copy link
Author

sai-cb commented Nov 27, 2024

Tested and confirmed that 6.0.1 does fix the regression, thank you!!!

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p4-important Violate documented behavior or significantly improves performance (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants