Skip to content

Hmr support#12

Merged
podhmo merged 4 commits intomasterfrom
hmr-support
Mar 13, 2026
Merged

Hmr support#12
podhmo merged 4 commits intomasterfrom
hmr-support

Conversation

@podhmo
Copy link
Copy Markdown
Contributor

@podhmo podhmo commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Hot Module Reloading (HMR) / WebSocket support to the proxy layer by ensuring upgrade requests are proxied correctly and by aligning Host/Origin handling for upstream dev servers.

Changes:

  • Bypass the HTML-injection response recorder for WebSocket upgrade requests to preserve http.Hijacker behavior.
  • Clone request headers (avoid mutating/sharing the original header map) and set upstream Host; rewrite Origin for same-host WebSocket requests to match the selected upstream.
  • Add Go tests covering WebSocket upgrade pass-through, HTML asset injection, and WebSocket routing to the correct origin.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
proxy/handler.go Adds WebSocket upgrade detection, skips recorder path for upgrades, clones headers, sets Host, and rewrites Origin for WS requests.
proxy/handler_test.go Adds regression tests validating WS upgrade behavior, injection on HTML responses, and correct origin routing for WS/HMR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread proxy/handler.go
Comment thread proxy/handler_test.go Outdated
Comment on lines +11 to +12
"sync/atomic"
"strings"
podhmo and others added 4 commits March 13, 2026 20:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@podhmo podhmo merged commit a8b0b73 into master Mar 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HMR support

2 participants