Skip to content

Specific error for timeouts #1331

Open
@pablote

Description

@pablote

I'm currently proxying requests like this:

this._proxy.web(req, res, { target: target.host, proxyTimeout }, err => {
				logger.error("Error proxying %s -> { Host: %s, URL: %s }: ", req.originalUrl, target.host, target.requestURL);
				logger.error(err);
				res.status(500).send();
			});

If the upstream server takes too long, the callback is run with the following error:

2019-03-28T19:49:22.165Z - error:  message=socket hang up, stack=Error: socket hang up
    at createHangUpError (_http_client.js:331:15)
    at Socket.socketCloseListener (_http_client.js:363:23)
    at emitOne (events.js:121:20)
    at Socket.emit (events.js:211:7)
    at TCP._handle.close [as _onclose] (net.js:557:12)
, code=ECONNRESET

Would it make sense to get a timeout specific error? so I can, if I chose to do so, return a specific timeout error like 504?

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