Skip to content

Specify incoming request socket timeout #1113

Open
@phillipj

Description

@phillipj

Hi!

I've found an issue allowing long running proxied connections to stay open. In this case, it's something we've seen related to the webpack dev server which has this http-proxy package as its dependency via http-proxy-middleware.

In practise what we've seen is that long running proxied requests are being closed after 2 minutes, even though we specify a longer timeout with the proxyTimeout option. That in turn may make some browser automatically retry the request which failed, which is absolutely not wanted in some scenarios -- the latter isn't really this package's fault, so feel free to ignore that part.

After digging for a while I found the root cause to be in this package's request handler (lib/http-proxy/index.js). By not setting a timeout on the incoming HTTP socket with request.setTimeout(), Node.js core sets 2 minutes by default.

Ideally we'd like to be able to set proxyTimeout to whatever number we want and be sure that's respected. That possibly means using the same value in request.setTimeout().

Does this sound okey to you? Any other thoughts?

Refs webpack/webpack-dev-server#369 (comment)

/cc @Martin-Wegner

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