Browser caching pages with Edge/MAC

(John gill) #1

Matrix Version:

Edge and MAC both seem to prevent all Matrix pages from ever being cached in the browser regardless of the Cache Manager settings.

Example - set up page with a Cache manager override set to Browser Cache for 10mins and Accelerator Cache for 60mins. When you request this page via Edge or MAC it will be served with the header Cache-Control: private, max-age=0.

I think this is due to Edge Side Includes (ESI), the logic being that you want the final caching to happen at the layer that is doing the final composition of the page. That way if you’ve got your left nav included via ESI and you updated it, users can get it immediately instead of seeing a browser cached copy. The issue is that it appears to override the desired browser cache setting even for pages that don’t have any ESI tags.

There are times when you really do want browsers to cache a dynamically generated response for some short period to avoid unnecessary overhead on every page (not to reduce traffic at the server, but at the client). Is it possible to get this behaviour again for a site behind Edge/MAC? (without throwing out the current behaviour on pages where you want it)

(Bart Banda) #2

Even without ESIs, the point of MAC and Edge and caching proxies like it, is to make sure that you can instantly update a page for anyone that visits, so that you can ensure no one sees the old copy. It’s by design. Even if it’s cached at the proxy level, the page should still be super fast to return. Note that Edge and MAC don’t cache files served from /__data/ the same way, those ones have their own cache settings and do get cached in browsers.

Can you share a use case where you need a page to be cached in user’s individual browsers rather than in a single, clear cachable, proxy layer?