aem-project-archetype icon indicating copy to clipboard operation
aem-project-archetype copied to clipboard

Remove User-Agent from vary header to improve cache-hit-ratio on CDN

Open keepthebyte opened this issue 3 years ago • 1 comments

Expected Behaviour

CDN or proxy is caching resources with high cache hit ratio.

Actual Behaviour

This is not the case as AEM per default adds the user agent to the vary header, that forces the CDN/proxies to add the user agent string to the cache-key, hence making caching ineffective. This is most likely a legacy setting, back from when CMS would render different output based on user agent string - e.g using WURFL for device detection and adjusting the output. AEM is no longer doing that and it's not recommended to do this anymore.

For example see:

See line 43 in: https://github.com/adobe/aem-project-archetype/blob/master/src/main/archetype/dispatcher.cloud/src/conf.d/available_vhosts/default.vhost

See line 20 in https://github.com/adobe/aem-project-archetype/blob/master/src/main/archetype/dispatcher.ams/src/conf.d/available_vhosts/aem_publish.vhost

More: https://github.com/adobe/aem-project-archetype/search?q=Header+append+Vary+User-Agent+env%3D%21dont-vary

This has already been fixed in the reference https://git.corp.adobe.com/Granite/dispatcher-k8s-base/pull/48/files and now also needs to be fix in the project archetype. wknd.site , aemcomponents.dev and Odin have been updated with the updated config.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

keepthebyte avatar Apr 18 '21 06:04 keepthebyte

look like https://github.com/adobe/aem-project-archetype/blob/master/src/main/archetype/dispatcher.cloud/src/conf.d/available_vhosts/default.vhost was already fix in #669

keepthebyte avatar Apr 18 '21 07:04 keepthebyte