简体   繁体   中英

Strategy to avoid caching of locales directory for react build with Akamai as CDN

The client application is a react build, hosted in an AWS S3, using it as a static server. This sits behind the Akamai's CDN layer. Now we have implemented multi-lingual support with localization using i18n.

So we have as the site labels and texts in different languages in respective JSON files in the following directory: <base-dir>/pubic/locales/{{lng}}

lng being the language. 'en' or 'zh' for example.

What should be the approach to avoid caching at Akamai layer, when the json file has been updated?

Thanks in advance!

The best bet is to either set the Time to Live (TTL) for the JSON to a sufficiently low value, or simply tell Akamai not to cache it. Default configuration behavior is to honor caching headers coming from the origin, so you could either specify it in your Akamai configuration or have the S3 origin send anti-caching headers.

You can always see the caching status of an object delivered through Akamai by using Akamai Pragma headers .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM