fix(core): resolve vite server.https for websocket server#381
Open
webfansplz wants to merge 1 commit into
Open
fix(core): resolve vite server.https for websocket server#381webfansplz wants to merge 1 commit into
server.https for websocket server#381webfansplz wants to merge 1 commit into
Conversation
commit: |
Contributor
There was a problem hiding this comment.
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 intoBuffers. - 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.
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 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 causedERR_OSSL_PEM_NO_START_LINE.This PR ports Vite's HTTPS config resolution into
packages/core/src/node/https.tsand applies it before creating the DevTools WebSocket server.