Failed API requests from FE App (status code = 0) are missing in Insights Logs

Petr Mach 0 Reputation points
2024-06-05T09:12:01.5133333+00:00

Our FE application receives errors when calling the endpoints of our dedicated API (hosted on Azure), which occur randomly on individual requests within the session. It is status=0, which the browser interprets as a CORS error, however, we have any origin enabled in the API code:

x.AddDefaultPolicy(builder => 
	builder.AllowAnyOrigin()
	.AllowAnyHeader()
	.AllowAnyMethod()
	.WithExposedHeaders('content-disposition'));

Often these errors are displayed in the network console browser as status=500 (see attached screen shots). But the problem is that we cannot find these failed requests in Insights. They just aren't there. We have already tried different variants on FE, nothing helps. Reloading, restarting the browser and changing the storage browser does not solve the problem, it will only start working after some time. If we open it in another browser, it works. We suspect that these failed requests will not reach the API at all. Is it possible that the problem could be somewhere in the infrastructure (load balancing,...)? We have 2 instances running as part of the service plan, so we assume that some load balancing is taking place. Is it possible to somehow monitor all incoming requests to these instances?

Screenshot1

screenshot2

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,154 questions
{count} votes