Skip to content

Vary = cache miss | Proposal = /.well-known/accept-language #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dtruffaut opened this issue Jul 16, 2022 · 0 comments
Open

Vary = cache miss | Proposal = /.well-known/accept-language #4

dtruffaut opened this issue Jul 16, 2022 · 0 comments

Comments

@dtruffaut
Copy link

dtruffaut commented Jul 16, 2022

Problem

Given

  • Developers need to send a Vary header on Accept-Language
  • Accept Language has lots of variations (language, script, region, subtags...)

This solution could lead to multiply each cache entry (example.com has many urls) by an order of thousand (all accept-language variations), leading to cache exclusions (LRU), thus tons of cache misses on edge servers. This would hurt performance a lot.

References on Vary and locales:

Solution

Expose accepted languages on a well-known url

/.well-known/accept-language
es fr en en-US en-GB pt pt-BR zh zh-Hant

  1. When user goes to example.com, the static page /.well-known/accept-language is queryied in parallel, and cached accordingly.
  2. While the page is loading, the Browser checks /.well-known/accept-language fast response and determines if there is a better language for the user among those proposed by example.com
  3. If so, Browser stops navigation and send Accept-Language: es
  4. Browser receives es content and displays it.
  5. On further navigations,
  • If the cache of the /.well-known/accept-language is valid, Browser queries this local cached file, select the best language and send Accept-Language: es
  • If the cache of the /.well-known/accept-language file is expired, Browser goes to step 1)

References on well-known urls:

Other possibilities:

  • robots.txt (easy, mastered by webdevs, but some noise involved by other information already present in that file)
  • dedicated sitemap (a little bit overwhelming)
@dtruffaut dtruffaut changed the title Vary = cache miss Vary = cache miss | Proposal = /.well-known/accept-language Jul 16, 2022
Tanych pushed a commit that referenced this issue Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant