01 Page caching - Strategies for Web Performance Optimization

Page caching is a technique used to improve the performance of web applications by storing the entire HTML output of a page and serving it directly from the cache for subsequent requests. This eliminates the need to generate the page dynamically on each request, reducing server load and improving response times. In this article, we’ll explore the concept of page caching, the HTTP caching basics it relies on, and the main places a full page can be cached, plus related techniques that cache smaller pieces.

August 4, 2021 · Updated October 29, 2026 · 6 min · 1074 words · Bá Tới

02 Page caching - Leveraging Page Caching with Varnish in Rails Applications

Varnish can cache whole Rails pages in memory and serve them without touching the application, but only if Rails tells it which pages are safe to share. In this article, we’ll let Rails mark public pages with Cache-Control, configure Varnish to honour those headers without leaking one user’s page to another, and add PURGE/BAN invalidation.

August 5, 2021 · Updated October 29, 2026 · 7 min · 1314 words · Bá Tới

03 Page caching - Implementing Page Caching in a Rails Application with Redis

Serving whole pages from a shared cache breaks Rails forms, because every visitor receives the CSRF token that was rendered for someone else. In this post, we’ll cache public pages with Rack::Cache backed by Redis and look at two ways to keep CSRF tokens working: fetching a fresh token with JavaScript from a small uncached endpoint, and a Rack middleware that injects one on the server.

August 6, 2021 · Updated October 29, 2026 · 9 min · 1714 words · Bá Tới

04 Page caching - Combining Page Caching in Rails with Nginx Memory Caching

Rails page caching and nginx make a natural pair: nginx serves the HTML files Rails writes to public/ straight from disk, and its proxy cache (stored on disk, indexed in shared memory) holds every other public response. In this guide, we’ll configure both, with a safe cache key, session-cookie bypass, cache locking and stale serving.

August 7, 2021 · Updated October 29, 2026 · 6 min · 1116 words · Bá Tới

05 Page caching - Maximizing Performance with HTTP Caching: A Comprehensive Guide

HTTP caching is a powerful technique for optimizing web performance and reducing server load. In this comprehensive guide, we’ll explore the fundamentals of HTTP caching, its benefits, implementation strategies, and best practices to help you harness its full potential.

March 23, 2024 · 3 min · 523 words · Bá Tới