Skip to content

Cache bundle assets for slow network connections#1195

Open
hwanseoc wants to merge 2 commits intopingdotgg:mainfrom
hwanseoc:cache-static-assets
Open

Cache bundle assets for slow network connections#1195
hwanseoc wants to merge 2 commits intopingdotgg:mainfrom
hwanseoc:cache-static-assets

Conversation

@hwanseoc
Copy link
Contributor

@hwanseoc hwanseoc commented Mar 18, 2026

What Changed

This adds long-lived cache headers for built files served from /assets/*.

/assets/* gets Cache-Control: public, max-age=31536000, immutable

Why

The entire JS/CSS payload is about 3 MB, which on a slow connection means a page load can take more than 10 seconds on every reload.

The cached files are this scoped to /assets/* only. These files are Vite build outputs with content-hashed filenames, so I expect them to be safe to cache aggressively even for development.

UI Changes

No UI or interaction change.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • No UI screenshots were needed because there is no UI change
  • No interaction video was needed because there is no interaction change

Note

Cache static bundle assets with immutable Cache-Control headers for slow network connections

Adds Cache-Control: public, max-age=31536000, immutable to HTTP responses for files served under the assets/ path in wsServer.ts. Files outside assets/ continue to be served without cache headers. A test is added to verify the header is present for hashed asset filenames.

Macroscope summarized c40dd7e.

Copilot AI review requested due to automatic review settings March 18, 2026 15:14
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9012f960-5d96-4416-803a-fabb363e8653

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable poems in the walkthrough.

Disable the reviews.poem setting to disable the poems in the walkthrough.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds aggressive caching headers for Vite-built static assets served by the server to improve reload performance on slow networks.

Changes:

  • Set Cache-Control: public, max-age=31536000, immutable for static files under /assets/*.
  • Refactor static-file response code to build a headers object before responding.
  • Add a server test asserting the cache header is present for /assets/... requests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/server/src/wsServer.ts Adds conditional Cache-Control header when serving static files under the assets/ prefix.
apps/server/src/wsServer.test.ts Adds a test ensuring /assets/* responses include the immutable cache header.

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

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@hwanseoc hwanseoc changed the title Cache t3code bundle assets for slow network connections Cache bundle assets for slow network connections Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants