fix(deploy): serve i18n JSON no-cache so translations refresh after deploy - #34
Merged
Merged
Conversation
…eploy
The S3 sync marked every non-index asset immutable (max-age=1y), including the
non-fingerprinted i18n/{lang}.json files — so browsers cached them for a year
and never picked up translations added in later deploys (raw keys / stale copy
across devices). Exclude i18n from the immutable sync and upload it (like
index.html) with no-cache,must-revalidate so the browser revalidates it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The deploy synced every non-
index.htmlasset to S3 withCache-Control: public, max-age=31536000, immutable, including the non-fingerprintedi18n/{lang}.jsonfiles.immutabletells browsers to cache them for a year without revalidating, so once a device cacheden.json/es.jsonit never picked up translations added in later deploys (raw keys / stale translations across devices). The CloudFront/*invalidation refreshes the CDN, but a browser'simmutablecopy never asks the CDN again.Exclude
i18n/*from the immutable sync and upload it (likeindex.html) withno-cache, must-revalidate, so browsers revalidate the JSON (ETag → 304) and get the fresh file after each deploy. Complements the per-load?v=cache-bust already ondevelop.Feature module / area: build / ci (deploy workflow)
Related issue / US: —
Type of Change
fix— bug fixbuild/ci— build, dependencies, or CI/CDChecklist
develop(notmain)feature/*,bugfix/*, orhotfix/*.envcontent committedHow to Test
develop(staging) or inspect the workflow.i18n/en.jsonresponds withCache-Control: no-cache, must-revalidate(notimmutable); after a deploy that changes a translation, a reload shows the new value.Notes
bugfix→develop. The same change ships to production via thehotfix/i18n-immutable-cache→mainPR.