Request thread getting initiated multiple times for same request

In my usecase , when i hit request from UI ,the call goes through Apigee and i can see the trace for same request got initiated twice and sometimes more than that within a gap of milliseconds.

  • In the flow , i can see that it is buffering in service callout to get the response form backend. But when i check the logs in Backend ,I am not getting the call logged over there.
  • But the subsequent request for the same service is working as expected and i am able to get successful trace in Apigee as well as in Backend log service.

Attached screenshot for reference.

3354-apg-transaction1.png

3355-apg-transaction2.png

Can anyone please help with what exactly the issue is?

1 2 454
2 REPLIES 2

Could the problem be caused by a CORS preflight, not properly handled by your API proxy?

I see OPTIONS requests in there. Are you explicitly sending those? Or ... are they being implicitly sent?

How are you invoking the API? You wrote, "In my usecase , when i hit request from UI..." What does that mean, exactly? "hit request from UI" ? Which UI?

CORS is implemented with some magic intelligence in web browers. The way it works - for a request that requires a pre-flight check, the browser sends out an OPTIONS request. Generally an API hosted in Apigee Edge won't proxy the OPTIONS request, but will respond directly (you might call it a "loopback"). The browser examines the response to the OPTIONS call, and then will proceed in sending the original call if the "pre-flight" check passes. For subsequent requests, the browser will remember the result of the pre-flight check, and won't send more OPTIONS requests.

This could be consistent with your description of: "the subsequent request for the same service is working as expected"

Former Community Member
Not applicable

Looks like you haven't configured your proxy to handle CORS pre-flight requests. Here is an example of how to configure CORS support in your proxy. The behavior of the trace tool seems to be consistent in how it handles CORS requests.