2 years ago

#56119

test-img

David Klempfner

Why is Azure APIM preflight response so slow?

I have an app service which is accessed via APIM. Intermittently (about 1/5), HTTP responses for GET requests are taking >1 minute.

I noticed the preflight request is taking 1.4 minutes, which makes me think there is nothing wrong with the application itself, but rather with APIM.

I've confirmed that there is nothing DB related that is causing the slowness.

I have this policy set up in the API.

Does this mean the preflight request is being responded to by APIM, and not the backend web service?

<inbound>
        <cors>
            <allowed-origins>
                <origin>*</origin>
            </allowed-origins>
            <allowed-methods>
                <method>*</method>
            </allowed-methods>
            <allowed-headers>
                <header>*</header>
            </allowed-headers>
        </cors>
        <base />
    </inbound>

Here is the preflight request: enter image description here

And the timing: enter image description here

Here's the actual request: enter image description here

And the timing: enter image description here

I've replicated this slowness using Chrome with disabled security settings:

"C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-web-security --ignore-certificate-errors --user-data-dir="C:/ChromeDevSession" 

in order to avoid the preflight request, however the response still takes about 1.4 minutes.

So the preflight request itself is not causing slowness.

I've tested the exact same request through the APIM test tab and am unable to replicate the slowness.

We have other app services running which are not behind APIM and they run fine, which is why I believe the issue is APIM.

However I'm very confused as to why I can't replicate the issue within the APIM test tab in the Portal (I've tried 100 times).

The only difference between the requests is that I've left out the Connection: keep-alive header in APIM because it was causing a 500 response.

Here's the pricing tier info:

enter image description here

Why is APIM intermittently slow and why is it only experienced through the web browser and not through the APIM test tab in the Portal?

azure

http

cors

azure-api-management

0 Answers

Your Answer

Accepted video resources