Does Cloudflare allow Caching of json APIs which are authnenticated using Authorization Header*

Cache Level: Cache Everything, Edge Cache TTL: 2 hours

I have added the above page rule but still not getting cached

Below are the reponse Headers of the API request :
Cache-Control:no-cache, private

This sounds like something the application is setting as a part of the response.

A Page rule with Cache Everything and an Edge Cache TTL should override any origin cache settings.

There must be something else going one. Because you have it behind Access, it’s going to be tough to test, but Rule Tracer might proceed far enough to get a hint:

@Cyb3r-Jak3 @sdayman
I tried Rule Tracer It that the Pagel rule was active for the request apart from no additional usefull information with status of the request.
One more question Ideally caching should work even for Authenticated APIs (APIs that require Authorization Header in request) ?

Also caching of Authenticated APIs is shared or separate for each user.

Try adding “Origin Cache Control: OFF” in your Page Rule.

This worked thank you so much.
I have added a cache rule to respect origin cache control headers.
Also to Cache the response on per user basis and security of the users data should I use both of the below headers
Cache-Control: private
Vary: Authorization

or only
Cache-Control: private

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.