nitro
nitro copied to clipboard
Nitropack dev server breaks all websocket connection
Environment
Nitropack: 0.4.24 Node: v14.18.2
Reproduction
Try to listen to a websocket in the server and run the server via nitropack dev server
Describe the bug
No websocket works
- I am using Nuxt3 RC8. And I noticed no websocket works when I am running
nuxt dev
. But it works totally fine when I am running the prod version
Additional context
You need additional setup to make http-proxy
package works with websocket.
Some important setup was missed here
https://github.com/unjs/nitro/blob/main/src/dev/server.ts#L135
See also:
Handling done by http-proxy-middleware
https://github.com/chimurai/http-proxy-middleware/blob/2.x/src/http-proxy-middleware.ts#L70
https://github.com/chimurai/http-proxy-middleware/blob/2.x/src/http-proxy-middleware.ts#L80-L83
https://github.com/chimurai/http-proxy-middleware/blob/2.x/src/http-proxy-middleware.ts#L86-L93
Logs
No response
You are right. Currently Nitro does not supports websockets. Working on it.