fix(client): infer socket host from script location (fix: #3093)#4168
Closed
speigg wants to merge 1 commit intovitejs:mainfrom
Closed
fix(client): infer socket host from script location (fix: #3093)#4168speigg wants to merge 1 commit intovitejs:mainfrom
speigg wants to merge 1 commit intovitejs:mainfrom
Conversation
Infer socket hostname/port from script location Fix vitejs#3039
Author
|
I'll revise this later, need to fix broken tests. |
Member
Great, thanks for the PR. This looks really useful |
6 tasks
14 tasks
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.
Description
Currently, the socket hostname is inferred from the current page location. This PR changes the inference logic to be based on the location of the client script, and adds support for inferring the socket port in addition to the socket hostname.
Additional context
Inferring socket location from client script location is more robust than assuming the current page is hosted by the vite dev server. For example, consider a web component being developed on a vite dev server, routed through a reverse proxy, and loaded into a web page on a different origin—by inferring socket host from client script location, this scenario "just works".
In addition, port number inference should make it easier to rely on default configuration settings when switching between localhost and/or reverse proxy configurations, or reverse proxies with random port numbers (e.g. #3093) .
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).