I am making a POST request to the backend. The stuff happening on the backend is pretty complicated, and will take a few minutes to return a response. Unfortunately, the POST request is timing out after exactly 1 minute. I need the browser to wait longer than 1 minute for a response.
Here is my original code:
bulkLookupRequest(req) {
return this.http.post(this.bulkLookupUrl, req)
.toPromise();
}
I have searched and searched for a solution online. I have tried:
bulkLookupRequest(req) {
return this.http.post(this.bulkLookupUrl, req)
.timeout(600000) // ten minutes
.toPromise();
}
Which still timed out after exactly 1 minute.
I have also tried:
bulkLookupRequest(req) {
return this.http.post(this.bulkLookupUrl, req, { headers: new HttpHeaders({ timeout: `${600000}` }) })
.toPromise();
}
It still timed out after 1 minute.
Am I missing something? Could something else, like Apache settings, be interfering?
Observableinstead ofPromise. however i strongly recommend sending the request to initiate the 'complicated code' asynchronously (without waiting the response) then let the server push notification back to client when it finishes using something like signalR