Caching, CDN & Static Assets
Production performance depends heavily on HTTP caching. Fingerprinted JavaScript and CSS assets can often be cached for a long time because a changed build produces a new filename.
HTML and API responses have different freshness requirements. Cache headers should reflect whether content is immutable, public, private, or rapidly changing.
A CDN can reduce latency by serving static assets from locations closer to users, but caching incorrect personalized content can become a security issue.
Key Takeaways
- Fingerprint immutable assets for safe long-term caching.
- Never cache personalized responses publicly by accident.
- Choose cache policy based on data ownership and freshness.