Implement Rate Limiting in Ruby on Rails

Rate limiting is a common technique used to control the rate of incoming requests to a web application and prevent abuse or overload. Learn how to implement rate limiting in a Ruby on Rails application using middleware and Redis.

May 2, 2024 · 8 min · 1684 words · Bá Tới

Middleware in Rails: A Comprehensive Guide

Middleware in Rails is a powerful feature that allows you to intercept and modify HTTP requests and responses. Learn how to use middleware in Rails to add custom functionality, enhance performance, and improve security in your web applications.

March 25, 2024 · 4 min · 644 words · Bá Tới

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