-
Notifications
You must be signed in to change notification settings - Fork 875
Open
Description
Checks
- I understand project setup issues should be asked on StackOverflow or in GitHub Discussions.
- I updated to latest
http-proxy-middleware.
Describe the bug (be clear and concise)
It seems that the proxy (websocket) only works on the protocol of the first request.
If a proxy endpoint (the initial request) is first visited with the ws protocol, the proxy will only work on ws.
If you first visit on wss, the proxy will only work on wss.
So if the initial request was on the ws protocol, the proxy won't resolve a response on wss and keeps in the "connecting" state as it keeps waiting for a response from the proxy. This can also be performed the other way around. First wss then ws
Step-by-step reproduction instructions
1. `npm install`
2. `npm run dev`
3. Visit `ws://localhost:3000/`, it will successfully proxy to the websocket server
4. Visit `wss://localhost/`, it will fail to resolve a responseRepro: https://github.com/Netail/repro-http-proxy-websocket
Expected behavior (be clear and concise)
Proxy should work on both protocols or at least resolve a response
How is http-proxy-middleware used in your project?
[email protected] <root>\repro-http-proxy-websocket
└── [email protected]What http-proxy-middleware configuration are you using?
https://github.com/Netail/repro-http-proxy-websocket/blob/main/proxy.ts
What OS/version and node/version are you seeing the problem?
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 20.45 GB / 31.93 GB
Binaries:
Node: 22.20.0
npm: 11.5.2
pnpm: 10.15.1
bun: 1.2.20Additional context (optional)
No response
Metadata
Metadata
Assignees
Labels
No labels