1

I'm using Angular HttpClient. The problem is that sometimes an error occurs and the client gets status 0 "Unknown Error" back. We've found that the problem only happens in Safari (iOS and Mac) and Internet Explorer 11 in our production environment.

As a workaround we've put a HttpInterceptor into the game, which makes 5 retries with 300 ms between each. This seems to fix the problem. But I would like to know the root cause.

I've read that others have the same problem, but here it seems like it's CORS related. But since the problem is resolved by retrying, it shouldn't be CORS. Right?

My HttpClient.get:

public getData(): Observable<Hentdata> {
  return this.httpClient.get<Hentdata>('api/hent')
            .pipe(catchError(err => this.handleError(err)));
}

Update #1: We've a F5 Big IP load balancer in front of our applications. I read that there could be some problems with keep-alive in that regards.

Any suggestions?

1 Answers1

0

Is there other error message in console of IE?

In most of the cases, they're CORS issues. You can try to use Fiddler and then try to visit the site using IE to see if it works. If this can work, I think it's CORS issue. In Fiddler's AutoResponder, you can edit the rule to have an Access-Control-Allow-Origin response header that contains the value of the origin of the requesting site.

Besides CORS issues, there're many other causes of the error code. You can refer to this answer for detailed information. It might relate with the load balancer such as the connection dropped during the request or the request timed out. You can load your app without load balancer in IE to see if the issue still persists. If it can work well without load balancer, then you can say the issue comes from the load balancer.

Yu Zhou
  • 11,532
  • 1
  • 8
  • 22