Skip to content

EventSource upstream connection not closed #1520

@carlhopf

Description

@carlhopf

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:

res.on('close', () => {
  if (!res.finished) proxyRes.destroy();
});

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions