feat: add browser streaming proxy routes#25
Merged
Conversation
KayTV
previously approved these changes
Oct 14, 2025
Collaborator
KayTV
left a comment
There was a problem hiding this comment.
overall looks good to me!
|
|
||
| // Connect to the browser streaming WebSocket | ||
| const ws = new WebSocket(connectionInfo.url); | ||
| console.log('Connecting to browser stream:', wsUrl); |
KayTV
approved these changes
Oct 14, 2025
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.
Ticket
Adds browser streaming proxy infrastructure and improves fullscreen user control mode
Changes
Added three new API routes to support browser streaming in production:
/api/browser-ws-config- provides runtime WebSocket proxy configuration/api/browser-stream-proxy- secure WebSocket proxy that bridges wss:// client connections to ws:// backend (solves mixed content blocking in HTTPS deployments)/api/mastra-proxy- server-side proxy for Mastra backend to handle CORS and enable runtime URL configurationEnhanced the browser artifact fullscreen mode with a global Escape key listener that exits user control mode when pressed, merged with upstream cleanup improvements that now properly check WebSocket state before disconnecting.
Testing
Tested manually in dev environment:
Context for reviewers
The proxy routes solve two key production issues: browsers block insecure WebSocket connections (ws://) from HTTPS pages, and Next.js build-time env vars can't be changed at runtime for different environments. The server-side proxies handle both. The keyboard handler was added to improve UX in fullscreen mode but had a merge conflict with upstream cleanup improvements - both changes are now included.