-
Notifications
You must be signed in to change notification settings - Fork 2k
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
EventSource upstream connection not closed #1520
Comments
Is it fixed? |
@carlhopf had been searching for hours and your solution fixed everything, yes they should add this to the package for sure! |
- close proxy response on original response close - see http-party/node-http-proxy#1520
The workaround provided will only work the first time as the proxy is going to be destroyed |
I am having a similar issue with EventSource connections through http-proxy v1.18.1. Mine work in development (create-react-app), but when deploying to production, the connection fails with the following browser (chromium) error:
The portion of my server.js that creates the proxy is:
and the HTML document that React/NodeJS appears to be returning to the browser instead of the EventStream data is:
I am 100% sure that my backend (springboot in this case) server is returning the correct response type because it works in dev, and it works in production using a non-React/express client. Any suggestions? |
Thanks to @didavid61202, a possible fix is merged to unjs/httpxy |
I'm using webpack-dev-server (which uses node-http-proxy) to proxy EventSource connections. Demo project: https://github.com/carlhopf/webpack-dev-server-proxy-eventsource
When calling
eventSource.close()
client/browser side, the node-http-proxy upstream connection is not closed.I fixed this attaching a listener in the
proxyRes
event:I guess this could added to https://github.com/http-party/node-http-proxy/blob/1.18.1/lib/http-proxy/passes/web-incoming.js#L181
Is this the way to go, should I send a pull request?
The text was updated successfully, but these errors were encountered: