How to increase HTTP request timeout more than 2 minutes in Angular 7?
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
}
}
Related videos on Youtube
Ahmad Tamimi
Updated on June 04, 2022Comments
-
Ahmad Tamimi almost 2 years
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?
-
Ahmad Tamimi over 4 yearsThis exactly what I have. It works now, Thanks @marcos.
-
Thariq Nugrohotomo over 3 yearsGoing to upvote this twice if I can. I'm not sure why the timeout setting is pretty difficult to find within the official documentation.
-
Klemens Zleptnig over 3 yearsLooks like this is for the webpack dev server, isn't it? How can I configure it if it's not running on dev server?
-
Muhammad Hamza almost 3 yearsThis probably won't be valid for production though imo.