Skip to content

fix: update S3 cache rule for index.html#2761

Open
rmnbrd wants to merge 1 commit into
stagingfrom
fix/s3-asset-caching-strategy
Open

fix: update S3 cache rule for index.html#2761
rmnbrd wants to merge 1 commit into
stagingfrom
fix/s3-asset-caching-strategy

Conversation

@rmnbrd

@rmnbrd rmnbrd commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Issue: Slack thread

"Importing a module script failed" errors

We're having a lot of "Importing a module script failed" errors. The bug seems to happen a lot on Safari, which applies heuristic caching when Cache-Control is absent, but uses a different algorithm compared to Chrome-based browsers.

When neither Cache-Control nor Expires is present, an HTTP cache may assign a heuristic freshness lifetime. This is standardized in RFC 9111 §4.2.2:

Since origin servers do not always provide explicit expiration times, a cache MAY assign a heuristic expiration time when an explicit time is not specified, employing algorithms that use other field values (such as the Last-Modified time) to estimate a plausible expiration time. This specification does not provide specific algorithms, but it does impose worst-case constraints on their results.

The fix is for index.html to not be cached, by adding a Cache-Control: 'no-cache' header.

Sources

Why you should use Cache-Control: no-store on index.html
HTTP Heuristic Caching

Screenshots / Recordings

image

Testing

  • Changes tested locally in the relevant Console's pages and Storybooks
  • yarn test or yarn test -u (if you need to regenerate snapshots)
  • yarn format
  • yarn lint

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible (e.g. feat(service): add new Terraform service) - required for semantic-release
  • I only kept necessary comments, written in English (watch for useless AI comments)
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code

@rmnbrd rmnbrd marked this pull request as ready for review June 16, 2026 08:42
Copilot AI review requested due to automatic review settings June 16, 2026 08:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the GitHub Actions deploy workflow to set explicit Cache-Control headers when uploading the built Console to S3, aiming to prevent stale index.html from being cached (notably in Safari) while allowing long-term caching for static assets.

Changes:

  • Upload non-index.html artifacts with long-lived cache headers.
  • Upload index.html last with Cache-Control: no-store to avoid stale SPA entrypoints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/test-build-and-deploy.yml Outdated
@rmnbrd rmnbrd force-pushed the fix/s3-asset-caching-strategy branch from 6a63d23 to e948e32 Compare June 16, 2026 11:31
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

Successfully merging this pull request may close these issues.

2 participants