cache-lookup API Management Policy

Karl Gardner 165 Reputation points
2024-09-15T17:19:03.1166667+00:00

Hello,

I am trying to learn more about API Management caching and have 2 questions about cache-lookup policy:

  1. The documentation mentions that downstream-caching-type can be set to none, private, or public. However, it doesn't really mention what downstream caching is so wondering if someone can explain this more?
  2. For the allow-private-response-caching attribute it says it allows for caching with the Authorization header. However, you can also have a vary-by-header element:

<vary-by-header>Authorization</vary-by-header>

So how would these two relate? Let's say I have the allow-private-response-caching attribute set to false. Would this not allow for caching with the Authorization header with the vary-by-header element?

Thanks,

Karl Gardner

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,078 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ben Gimblett 4,335 Reputation points Microsoft Employee
    2024-09-17T11:08:03.7966667+00:00

    Hi Thanks for the question

    For #1 - this is not really about APIM but generally about cache control headers work which APIM supports in its position as a Layer7 [reverse] proxy. The following SO post indirectly explains it https://stackoverflow.com/questions/3339859/what-is-the-risk-of-having-http-header-cache-control-public

    Incidentally, the terms "downstream" and "upstream" in context can be confusing - that's discussed in blogs, but this SO post is a good reference https://stackoverflow.com/questions/32364579/upstream-downstream-terminology-used-backwards-e-g-nginx

    for #2
    As per docs "allow-private-request-caching" is simply saying "you can cache if an auth header is present" whereas vary-by is a bit more complex. These are two different things.
    For a reasonable deep dive into vary see this https://www.smashingmagazine.com/2017/11/understanding-vary-header/


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.