Problem/Motivation
ResponseSubscriber::onRespond() runs on every response of the whole site and unconditionally appends Accept-Language to the Vary header of anything implementing CacheableResponseInterface, which includes every ordinary HTML page. Browsers send highly variable Accept-Language values (en-US,en;q=0.9, fr-FR,fr;q=0.9,en;q=0.8, ...), so any reverse proxy or CDN honouring Vary fragments its cache of every page per browser language string, collapsing hit ratios for responses that do not vary by language at all. Only the module's own surfaces actually vary by that header.
Steps to reproduce
- Install the module on any site behind a Vary-honouring proxy (or just inspect headers).
curl -skI https://example.test/user/login | grep -i varycontains Accept-Language, although that page does not vary by it.
Proposed resolution
Scope the Vary addition to the module's own surfaces.
Issue fork jsonapi_multilingual-3613670
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
lauriii