Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7987037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:01:58+00:00 2026-06-04T12:01:58+00:00

I was wondering if anyone could tell me what the default HTTP request timeout

  • 0

I was wondering if anyone could tell me what the default HTTP request timeout is when using express.

What I mean by this is: after how many seconds of dealing with a http request will the Express / Node.js server close the connection, when the browser nor server closed the connection manually?

How do I alter this timeout for a single route? I would like to set it to about 15 minutes for a special audio conversion route.

Thanks a lot.

Tom

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:01:59+00:00Added an answer on June 4, 2026 at 12:01 pm

    req.connection.setTimeout(ms); might be a bad idea since multiple requests can be sent over the same socket.

    Try connect-timeout or use this:

    var errors = require('./errors');
    const DEFAULT_TIMEOUT = 10000;
    const DEFAULT_UPLOAD_TIMEOUT = 2 * 60 * 1000;
    
    /*
    Throws an error after the specified request timeout elapses.
    
    Options include:
        - timeout
        - uploadTimeout
        - errorPrototype (the type of Error to throw)
    */
    module.exports = function(options) {
        //Set options
        options = options || {};
        if(options.timeout == null)
            options.timeout = DEFAULT_TIMEOUT;
        if(options.uploadTimeout == null)
            options.uploadTimeout = DEFAULT_UPLOAD_TIMEOUT;
        return function(req, res, next) {
            //timeout is the timeout timeout for this request
            var tid, timeout = req.is('multipart/form-data') ? options.uploadTimeout : options.timeout;
            //Add setTimeout and clearTimeout functions
            req.setTimeout = function(newTimeout) {
                if(newTimeout != null)
                    timeout = newTimeout; //Reset the timeout for this request
                req.clearTimeout();
                tid = setTimeout(function() {
                    if(options.throwError && !res.finished)
                    {
                        //throw the error
                        var proto = options.error == null ? Error : options.error;
                        next(new proto("Timeout " + req.method + " " + req.url) );
                    }
                }, timeout);
            };
            req.clearTimeout = function() {
                clearTimeout(tid);
            };
            req.getTimeout = function() {
                return timeout;
            };
            //proxy end to clear the timeout
            var oldEnd = res.end;
            res.end = function() {
                req.clearTimeout();
                res.end = oldEnd;
                return res.end.apply(res, arguments);
            }
            //start the timer
            req.setTimeout();
            next();
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if anyone could tell me if this kind of behaviour is
I was wondering if anyone could tell me if what I'm trying to accomplish
I was wondering if anyone could tell me how to implement line 45 of
I was wondering if anyone could show me how to search this array that
I was wondering if anyone could explain what this rule is saying: <IfModule mod_rewrite.c>
I was wondering if anyone could tell me how I'm supposed to initialise a
I was wondering if anyone could tell me (with an example if possible) the
I was wondering if anyone could tell me how to represent the enumeration of
UPDATE: For anyone else wondering about this, check out the comment at http://www.php.net/manual/en/function.imagecreatefromstring.php#31178 I
Just wondering if anyone could help me with this. I'm new to actionscript, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.