How to disable caching on specific origin with Azure Front Door load balancing?

Nibbler 656 Reputation points
2024-07-26T12:36:25.85+00:00

Hello,

I have configured load balancing on Front Door Origin Group with two origins.

Origin 1 serves as the application, while the Origin 2 serves a maintenance page (simple index-html file) using a storage account (static web). Whenever Origin 1 is deemed unhealthy, requests are routed to Origin 2.

However, I don't want Origin 2 to be cached, so the maintenance page will not continue to be served when Origin 1 is healthy. How can I achieve this if possible?

Thanks.

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

Accepted answer
  1. KapilAnanth-MSFT 46,096 Reputation points Microsoft Employee
    2024-07-29T04:33:16.19+00:00

    @Nibbler ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    Caching is done at Route and not at Origin Group or Origin.

    So caching property cannot be configured for a specific Origin Group or Origin and this property would depend on the route only.

    What you can instead do is use Cache-control directives at the "maintenance page" Origin.

    • In the AFD, you define the Cache behavior as either "Override if origin missing" or "Honor origin"
    • With "Override if origin missing"
      • Don't specify any cache directives in the regular page, let AFD handle it
      • In the maintenance page, specify the cache directives to not cache
    • With "Honor origin"
      • In the regular page, specify the cache directives as appropriate
      • In the maintenance page, don't cache
    • See :
      • User's image

    Refer : Caching with Azure Front Door

    Origins may specify not to cache specific responses using the Cache-Control header with a value of no-cache, private, or no-store. When used in an HTTP response from the origin server to the Azure Front Door POPs, Azure Front Door supports Cache-control directives and honors caching behaviors for Cache-Control directives in RFC 7234 - Hypertext Transfer Protocol (HTTP/1.1): Caching (ietf.org).

    Hope this helps.

    Thanks,

    Kapil


    Please Accept an answer if correct.

    Original posters help the community find answers faster by identifying the correct answer.


0 additional answers

Sort by: Most helpful

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.