0

I am trying to download a fairly large file (500MB) from an NodeJS API endpoint, but the following code appears times out with a 504 Gateway Timeout:

  async download(res: Response) {
    const path = `${this.EXCEL_SAVE_DIR}/report.xlsx`;
    try {
      if (fs.existsSync(path)) {
        res.download(path);
      } else {
        logger.debug(`download -> file not found at: ${path} `);
      }
    } catch (err) {
      logger.debug(`download -> error: ${JSON.stringify(err)}`);
    }
  }

Is it possible to avoid these timeouts?

methuselah
  • 11,964
  • 41
  • 148
  • 269

1 Answers1

2

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

Increase proxy time out in Nginx

proxy_read_timeout 600s;

sojin
  • 1,728
  • 1
  • 8
  • 15