Conversation
resure
marked this pull request as ready for review
September 30, 2026 20:25
This branch has not been deployed
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.
The dev-server client is injected into every entry, workers included. Some setups start a worker from a
blob:URL, for example a small blob that sets the public path and callsimportScriptsso worker code can load from a CDN. In such a workerself.locationhas theblob:protocol and an empty hostname and port, so when the dev server runs plain HTTP behind a TLS-terminating proxy, the client never replaceshostname=0.0.0.0with the page's host or upgradesws:towss:. It triesws://0.0.0.0/..., and on an HTTPS pagenew WebSocketthrows aSecurityErrorwhile the worker is loading, which the page receives as a worker error. ForcingwebSocketURL.protocoltowssonly turns that into endless reconnects towss://0.0.0.0.With this change, a
blob:worker with a real origin takes the hostname, protocol and port fromself.location.origin, which is the origin of the page that created it, and connects to the same socket as the page. Pages, http(s) workers, explicitly configured hostnames and protocols,data:workers and blob workers with an opaque ('null') origin behave as before.This PR is mostly AI generated, but I've verified fix on a real project.