Repository navigation
fix(webui): let the CDN hold unversioned SDK bundles for 10 minutes, not 30 days - #249
Merged
Merged
Conversation
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.
What
Unversioned SDK and survey runtime bundles (
/js/forma.umd.js,/js/surveys.umd.jsand their.cjstwins, without a matching?v=) are now sent withs-maxage=600instead ofs-maxage=2592000. Browser caching (max-age=3600),stale-while-revalidate=3600,stale-if-error=86400and the weak ETag are unchanged. Pinned and content-named URLs keepimmutable.Why
Same class of bug as the favicon in #155. These files keep fixed names because customer pages embed them, so a 30-day edge lifetime meant Cloudflare kept serving the previous release's SDK after every deploy. After 0.2.136 (Turnstile, #247) the edge still served a 27-hour-old
forma.umd.js(cf-cache-status: HIT,age: 97858) withoutsupportsTurnstile, whilesurveys.umd.jswas already new. A Turnstile-protected survey shown by that stale loader cannot get a token, and its first response would be refused. The.cjsURLs were not affected only because Cloudflare does not cache that extension by default.With 10 minutes at the edge, a release reaches every visitor within about 10 minutes plus the browser hour. Because of the ETag, the edge's revalidation is normally a 304, and stale-while-revalidate serves it in the background, so origin load stays negligible.
Tests
The header expectations in
internal/webui(webui_test.go,sdkcache_test.go), the client API contract fixturejs-surveys-umd.jsonand the Docker validation step are updated.go test ./internal/webui/... ./internal/clientapi/...passes on the Studio.Rollout note
This changes only what the edge stores from now on. The copy of
forma.umd.jsalready at Cloudflare was stored with the 30-day lifetime and must be purged once by URL:https://forma.yldm.ai/js/forma.umd.jsandhttps://forma.yldm.ai/js/surveys.umd.js.