adobe / adobe/aem-project-archetype
Remove User-Agent from vary header to improve cache-hit-ratio on CDN
- Dominant language
- JavaScript
- Stars
- 596
- Forks
- 431
- Avg merge
- 10d 6h
- Merged PRs (30d)
- 1
Description
### 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
Contributor guide
Research direction
Start with the two named vhost files: src/main/archetype/dispatcher.cloud/src/conf.d/available_vhosts/default.vhost and src/main/archetype/dispatcher.ams/src/conf.d/available_vhosts/aem_publish.vhost, then compare their Vary handling with the referenced dispatcher-k8s-base change. Done means the generated archetype configuration no longer adds User-Agent to Vary and the affected configuration remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100