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

  1. Install the module on any site behind a Vary-honouring proxy (or just inspect headers).
  2. curl -skI https://example.test/user/login | grep -i vary contains Accept-Language, although that page does not vary by it.

Proposed resolution

Scope the Vary addition to the module's own surfaces.

Command icon 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

lauriii created an issue. See original summary.

  • lauriii committed 1eeddf33 on 1.0.x
    fix: #3613670 Vary: Accept-Language is added to every cacheable response...
lauriii’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.