Repository navigation
fix(hub): advertise SSE path relative to connection meta - #519
Open
webfansplz wants to merge 1 commit into
Open
webfansplz wants to merge 1 commit into
webfansplz wants to merge 1 commit into
Conversation
|
@webfansplz is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the SSE discovery changes intended to preserve proxy prefixes.
No open issues 🎉
What changed in this PR
Fixes hub SSE discovery behind path-prefixed proxies by making advertised paths relative to each served __connection.json.
Changes:
- Uses relative SSE paths for hub and frame metadata, preserving proxy prefixes.
- Leaves
connectionMeta()and WebSocket paths unchanged. - Adds regression coverage for hub and frame URL resolution.
| File | Description |
|---|---|
packages/hub/src/node/initiate.ts |
Converts SSE paths to relative paths when serving metadata. |
packages/hub/src/node/__tests__/initiate.test.ts |
Tests SSE resolution with a stripped proxy prefix. |
Review effort: Balanced
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.
Description
initHubadvertises a root-absolute SSE path in__connection.json, such as/__devframes/__sse. When the hub is served behind a path prefix, the client resolves that path against the meta URL and loses the prefix:The SSE request then fails, or reaches another hub if one is running at the root. On Bun, this can break the default connection, since the hub advertises SSE instead of WebSocket when it shares the host's HTTP server.
This PR makes the SSE path relative to each served
__connection.json:__ssefor the hub and../__ssefor frames mounted under it. The client already resolves the path this way, so it needs no changes.Additional context
connectionMeta()still returns the absolute path, because custom hosts may serve that object from other directories.Tested through Vite DevTools with Node and Bun servers, both behind a proxy that only forwards
/foo/and in a nested setup where the parent strips the prefix. SSE connections from the hub meta now reach the right hub in all of these cases.Related: vitejs/devtools#662