Skip to content

Proxy results in EPIPE errors when forwarding to a socket #675

@mhassan1

Description

@mhassan1

yarn why http-proxy-middleware OR npm ls http-proxy-middleware output (mask private folder names with *****)

project@ /path/to/project
└── http-proxy-middleware@2.0.1

Describe the bug (be clear and concise)

When proxying to a socket, we are seeing EPIPE errors every so often (after a few hundred requests). Here is how we are proxying to a socket:

createProxyMiddleware({
  target: { host: null, port: null, socketPath: 'sock.sock' }
})

This only seems to be an issue in Node.js 16.7.0 and later, on Linux.

I do not think this is a bug in this library, since I can reproduce this even using a simple http proxy without this library. I have opened a ticket with Node.js: nodejs/node#40553. I created this issue here in case others run into this issue.

Step-by-step reproduction instructions

See the full reproduction here: https://github.com/mhassan1/node-16-7-0-proxy-epipe

Expected behavior (be clear and concise)

No EPIPE.

What http-proxy-middleware configuration are you using?

{
  target: { host: null, port: null, socketPath: 'sock.sock' }
}

What OS/version and node/version are you seeing the problem?

Linux, Node.js 16.7.0+

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions