Skip to content

Proxy WebSocket connections with error handling #872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2025

Conversation

Hermholtz
Copy link
Contributor

Properly proxy WebSocket "upgrade" connections. Without this change any attempt to use http-server as a proxy for WebSocket does not work. The code also handles error cases when WebSocket server abruptly closes connection (or a network device dies between client and server). Other PRs fixing the same issue cause http-server to throw error and exit on WebSocket connection errors.

It's a useful addition to http-server for people developing WebSocket applications. There's no WebSocket proxy for Node.js easy to use from command line. This pull request makes http-server more versatile and helps local dev workflows.

The change is as minimal as possible, no code style changes, no whitespace changes etc. Please merge.

Relevant issues

Fixes #142.

Contributor checklist

Note: cannot provide unit tests for this change.
Note: this doesn't add any new command line options.

  • Provide tests for the changes (unless documentation-only)
  • Documented any new features, CLI switches, etc. (if applicable)
    • Server --help output
    • README.md
    • doc/http-server.1 (use the same format as other entries)
  • The pull request is being made against the master branch
Maintainer checklist
  • Assign a version triage tag
  • Approve tests if applicable

Sorry, something went wrong.

Copy link

This pull request has been inactive for 360 days

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@KernelDeimos KernelDeimos merged commit 9d7dd6b into http-party:master Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebSockets not supported in proxy mode
2 participants