Websockets can be proxied, but the method is undocumented
Created by: dceddia
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
Yes
Description
I was trying to proxy Websockets through the "proxy" feature built into CRA. With a proxy setting of "http://localhost:4000" (an express server), the Websocket doesn't work. However, with a URL of "ws://localhost:4000", the Websockets do work!
This is great. So why file this issue? There are 2 conflicting pieces of info in CRA:
- This comment in
start.js
implies Websockets are supported. - The README / User Guide says "Currently the proxy option only handles HTTP requests, and it won’t proxy WebSocket connections."
I'd be happy to submit a PR with these changes.
Expected behavior
The README should advertise Websocket proxying with the "ws://" prefix, and the comment in start.js should probably be updated to mention the prefix too.
Actual behavior
The current docs about Websockets undersell the actual functionality
Environment
This isn't environment-related.