I'm using Apache 2.4.25 to expose a number of back-end services using proxy pass. Apache also sets the cache control headers based on mime type. The current cache configuration looks like this:
ExpiresActive on
ExpiresDefault "now"
ExpiresByType text/html "now"
ExpiresByType image/gif "access plus 120 minutes"
ExpiresByType image/jpeg "access plus 120 minutes"
ExpiresByType image/png "access plus 120 minutes"
ExpiresByType text/css "access plus 60 minutes"
ExpiresByType text/javascript "access plus 60 minutes"
ExpiresByType application/x-javascript "access plus 60 minutes"
ExpiresByType text/xml "access plus 60 minutes"
ExpiresByType application/javascript "access plus 60 minutes"
ExpiresByType application/x-font-ttf "access plus 30 days"
ExpiresByType application/x-font-woff "access plus 30 days"
ExpiresByType application/x-font-eot "access plus 30 days"
ExpiresByType application/x-font-svg "access plus 30 days"
However, one of the back-end services is also setting the cache-control max-age header. This is causing the response header to contain two max-age settings.
Duplicate max-agent values as seen in Chrome
How does the browser react when presented with two max-age settings with different values? Also, is it possible to check for an existing cache-control header before adding the default?
set
instead ofadd
seems like the right thing to do, but I am still curious about how browsers interpret a duplicate setting. The RFC for Cache-control does not seem to specify any particular strategy: tools.ietf.org/html/rfc7234#section-5.2 so maybe it's simply undefined. If that's the case, I wonder if all browsers actually handle it in different ways, or maybe there's an implicit standard they all adhere to?