Azure Front Door Standard with cache enabled takes long time to respond to POST requests

Duy Nguyen 0 Reputation points
2025-03-17T18:55:48.3133333+00:00

We are using Azure Front Door (AFD) in front of a function app that serves as the backend and accepts only POST requests. We notice that when cache is enabled on the Front Door, it makes the app very slow. The performance is only fast when we disable the cache on the Front Door.

It seems that Front Door always checks for data against its cache no matter the method of the requests. Here is the diagram we come up with:

(AFD interactions.png)

User's image The step in red adds a lot of overhead to the Front Door when getting data for POST requests. This step is mentioned in the section “Return cached content” of this article: https://learn.microsoft.com/en-us/azure/frontdoor/front-door-routing-architecture?pivots=front-door-standard-premium.

We have built a sample app to mimic the behavior of our real app so that you can check the performance between Front Doors with cache enabled and cache disabled. You can access the deployment of the sample app at https://sfa-dev-cdne-uis-bgjv5archbaz4.azureedge.net, and the source code at https://github.com/nguyenduy/afd-cache-behavior.git.

In the app, the backend which is an Azure Function App serves only one POST API via route “api/postapi” which returns the current DateTime. The front end interacts with the backend in 4 different ways:

  1. Directly to the function app: The front end calls the API directly through the function app.
  2. Through AFD with cache enabled: The front end calls the API through a Front Door with cache enabled.
  3. Through AFD with cache disabled by a rule set: The front end calls the API through the same Front Door as above, but the request has a request header to signify the Front Door to disable the cache:User's image
  4. Through AFD with cache disabled: The front end calls the API through a Front Door that has cache disabled.

Here is the timing we recorded:

User's image

As you can see from the table above, with cache enabled, the timing is high.

One note here is we recorded the timing using the developer tool of Google Chrome under the Network tab:

User's image

So, our questions are:

  1. Why is AFD with cache enabled very slow when handling POST requests?
  2. Does the cache-checking step of AFD always happen for all request methods?
  3. If question 2 is a yes, why is that true for POST requests? In the documentation about caching of AFD, it says that only GET requests are cacheable. If POST requests cannot be cached, why does AFD still check data in the cache for them?

Quote from the documentation:

User's image

(https://learn.microsoft.com/en-us/azure/frontdoor/front-door-caching?pivots=front-door-standard-premium)

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
813 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sai Prasanna Sinde 5,005 Reputation points Microsoft External Staff
    2025-03-18T10:10:04.95+00:00

    Hi @Duy Nguyen

    1.Why is AFD with cache enabled very slow when handling POST requests?

    Only requests that use the GET request method are cacheable. All other request methods are always proxied through the network. This means POST requests are never cached by AFD. Therefore, the perceived slowness is not due to cache lookups, but rather the fact that AFD is forwarding the entire POST request to your origin server every time.

    Since AFD is always sending POST requests to the origin, the origin server becomes the bottleneck.

    2. Does the cache-checking step of AFD always happen for all request methods?

    While the documentation emphasizes that only GET requests are cacheable, this does not mean AFD entirely skips cache-related processing for other request methods.

    AFD's architecture likely involves a stage where it evaluates requests against its routing and caching rules. This evaluation happens regardless of the request method.

    The cache checking step is more of a rule's evaluation step. The front door needs to evaluate if there is any rule that applies to the request, and those rules could be related to caching, even if the request is not cacheable.

    3. If question 2 is a yes, why is that true for POST requests? In the documentation about caching of AFD, it says that only GET requests are cacheable. If POST requests cannot be cached, why does AFD still check data in the cache for them?

    AFD's Rules Engine allows you to define complex rules that can apply to any request, regardless of the method. These rules might include:

    URL rewrites, Header modifications, Routing decisions, WAF rules

    Even for POST requests, AFD needs to evaluate these rules. The cache-related checks are part of this broader rule evaluation process and for efficiency and consistency, AFD likely uses a unified request processing pipeline. This pipeline might include a stage where all requests are checked against the cache rules, even if the request method is not cacheable.


    Kindly let us know if the above helps or you need further assistance on this issue. 


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.