Skip to content

fix(core): resolve vite server.https for websocket server#381

Open
webfansplz wants to merge 1 commit into
mainfrom
fix/resolve-https
Open

fix(core): resolve vite server.https for websocket server#381
webfansplz wants to merge 1 commit into
mainfrom
fix/resolve-https

Conversation

@webfansplz

Copy link
Copy Markdown
Member

Fixes an HTTPS startup failure when Vite DevTools is used with a Vite server.https config whose TLS fields are file paths, such as the config produced by laravel-vite-plugin with Valet/Herd TLS detection. (Closes #345)

Vite normalizes server.https before creating its HTTP and HMR WebSocket servers by attempting to read ca, cert, key, and pfx string values as files. Vite DevTools creates its own WebSocket server from the resolved Vite config, but previously passed viteConfig.server.https directly to devframe / node:https.createServer(). Node treats string key and cert values as PEM content, not file paths, which caused ERR_OSSL_PEM_NO_START_LINE.

This PR ports Vite's HTTPS config resolution into packages/core/src/node/https.ts and applies it before creating the DevTools WebSocket server.

Copilot AI review requested due to automatic review settings June 15, 2026 13:55
@pkg-pr-new

pkg-pr-new Bot commented Jun 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/devtools@381
npm i https://pkg.pr.new/@vitejs/devtools-kit@381
npm i https://pkg.pr.new/@vitejs/devtools-rolldown@381
npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@381

commit: 4c4b65b

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes DevTools WebSocket server startup failures when Vite’s server.https config provides TLS fields (ca, cert, key, pfx) as file paths (as commonly produced by laravel-vite-plugin with Valet/Herd). It mirrors Vite’s own behavior by resolving those string values into Buffers before passing them to Node’s https.createServer() (via devframe).

Changes:

  • Added resolveHttpsConfig() utility to read TLS file-path strings into Buffers.
  • Applied resolveHttpsConfig() in the WS server creation path so DevTools doesn’t pass file-path strings directly to Node TLS.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/node/ws.ts Resolves the effective HTTPS server options before creating the DevTools WS server.
packages/core/src/node/https.ts New helper that reads ca/cert/key/pfx string values as files (falling back to the original value on read failure).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/node/https.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERR_OSSL_PEM_NO_START_LINE when using DevTools() plugin alongside laravel-vite-plugin (HTTPS dev server)

2 participants