Skip to content

feat: add cache control headers for static assets in .htaccess - #101

Merged
devaraj3 merged 1 commit into
mainfrom
perf/cache-hashed-assets
Aug 7, 2026
Merged

feat: add cache control headers for static assets in .htaccess#101
devaraj3 merged 1 commit into
mainfrom
perf/cache-hashed-assets

Conversation

@devaraj3

@devaraj3 devaraj3 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

What changed

  • Added a Cache-Control: public, max-age=31536000, immutable header for .js and .css files in public/.htaccess, alongside the existing rewrite rules (untouched)

Why

  • PageSpeed Insights flagged only a 7-day cache lifetime on hashed static assets. Since Vite gives every build's JS/CSS a unique content hash in the filename, a new deploy never reuses an old filename — so it's safe to cache these for a full year. Free performance for returning visitors, zero risk of serving stale content.
  • Scoped to only .js/.cssindex.html, viewer.html, the guide page, robots.txt, sitemap.xml, and llms.txt are deliberately untouched, since those aren't hashed and need to stay revalidated normally.

Validation

  • After deploy, run: curl -sI https://cadviewer.xyz/assets/<some-hashed-file>.js | grep -i cache-control and confirm it shows the new header
  • Spot-check a few page navigations live to confirm nothing broke

Notes

  • Header-only change, no rewrite logic touched — low risk

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cad-viewer Ready Ready Preview Aug 7, 2026 7:27am

@devaraj3
devaraj3 merged commit 5286198 into main Aug 7, 2026
6 checks passed
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.

1 participant