#179: negotiate the SPA shell's lang attribute in nginx #315
No reviewers
Labels
No Label
area:auth
area:docs
area:export
area:ops
area:storage
area:supply-chain
auth
backend
blocked
collab
deployment
docs
effort:L
effort:M
effort:S
frontend
plugins
qa
vs-nfd
vs-nfd:blocker
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: stwaidele/dorfteich#315
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-179-spa-lang"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements #179.
apps/web/index.htmlcarries a hardlang="en". The app corrects it at runtime (#163), but nginx answers every SPA route with that same file —/public/...on prod is exactly that — so a crawler or a no-JS visit sawenfor German content, permanently. WCAG 3.1.1 is about the delivered document, not the one JavaScript later fixes.nginx-only, as the issue sketched: a
maponAccept-Languageplus asub_filterin the index.html path. Only the FIRST tag decides — that is what "the browser's preferred language" means and it mirrors #163's semantics:de-CHcounts as German,en-US,dedoes not.Verified against a real nginx 1.27
The stage's own image (
nginxinc/nginx-unprivileged:1.27-alpine) with this config mounted as-is:de-DE,de;q=0.9,en;q=0.8lang="de"delang="de"en-US,en;q=0.9lang="en"en-US,en;q=0.9,de;q=0.8lang="en"fr-FR,frlang="en"lang="en"An SPA route (
/public/teich/seite) negotiates the same way; the gzipped response is rewritten too; a JavaScript asset comes through byte-identical.Header regression
CSP,
Cache-Control: no-cacheandnosniffare unchanged — checked on the live response, not just in the diff.One header is new:
Vary: Accept-Language. The response now genuinely depends on a request header, and without it a shared cache could hand one language's copy to the other. The location isno-cacheanyway, so this costs nothing and states the dependency correctly. Flagging it explicitly because the issue asked for the other headers to stay unchanged.Known limit, documented in the config
nginx cannot read
instance.defaultLocale, so an absent or unlisted Accept-Language yieldseneven on a German instance. For public content that is not the authoritative rendering — the api's server shell (/api/v1/public/...) already renders those with the instance locale.Spot-check on test after deploy still to do (
curl -H 'Accept-Language: de'against both a/and a/public/...URL).Closes #179
80dbe325f5to9fbaeb559b9fbaeb559bto8752cf0c5a