简体   繁体   中英

How to increase HTTP request timeout more than 2 minutes in Angular 7?

I have a request that takes more than 2 minutes to prepare the data in the backend and transmit it. The angular default time out for the HTTP request observable is 2 minutes. Any idea of how to increase the default timeout?

I read and tried the proposed solution in the following links, but all of them are working if you want to set the timeout less than 2 minutes, and none of them will work for increasing the timeout!!

https://rxjs-dev.firebaseapp.com/api/operators/timeout

Can't have a timeout of over 2 minutes with this.http.get?

How to increase waiting time for HttpClient request in angular 5?

How to set http call timeout in angularjs 4?

Default and specific request timeout

I didn't get a reply from you in the comments, but I was having this exact issue on my dev machine, and maybe that's happening to you as well.

I was using the proxy config , and the proxy's default timeout is 120 seconds (2 minutes). So, if that's your case, simply define a higher value in the configuration.

{
  "/api": {
    "target": "http://localhost:3000",
    "secure": false,
    "timeout": 360000
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM