Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298703

Allow different cache maximum age for browser and proxy

$
0
0

Problem/Motivation

Core provides a "Browser and proxy cache maximum age" setting that is used to set the Cache-Control header:

Cache-Control: max-age=60, public

When using a reverse proxy like Varnish, this header applies to both the reverse proxy and the browser (unless the reverse proxy has some logic to remove the header before it reaches the browser).

Our use case is this:

  • We want a low max age for the browser (because we have no way to invalidate the browser cache)
  • We want a high max age for the reverse proxy (because we can invalidate this cache with cache tags)

This is possible with the s-maxage directive:

Cache-Control: max-age=60, public, s-maxage=31536000

When both max-age and s-maxage are present, s-maxage applies to shared cache and max-age applies to browsers.

Steps to reproduce

Set cache.page.max_age to a high value like a year. (The interface does not let you do that right now: #3086787: Do not use select list for setting "cache maximum age" option)
Every cacheable response is cached for a very long time by both the reverse proxy and browsers.

Proposed resolution

We could introduce a new "Proxy cache maximum age" setting that would be used to set the s-maxage directive.

I think we should handle these scenarios:
Both max ages are 0:
Cache-Control: must-revalidate, no-cache, private

Both max ages are set:
Cache-Control: max-age=60, public, s-maxage=31536000

Only max-age is set:
Cache-Control: max-age=60, public

Only s-maxage is set:
Cache-Control: max-age=0, must-revalidate, public, s-maxage=600

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 298703

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>