Stuck in the Middle: Leverage the power of Rack Middleware
summary
Explains how to write and install custom Rack middleware, with concrete examples: a Ping Pong endpoint that short-circuits and returns 200 Pong, a request-response timer that records elapsed time and sends JSON to Splunk, and a rate-limiting limiter (Rack Throttle) that returns rate-limit responses before the app sees them. Covers order issues (Warden must come after session middleware), moving redirects for addons.heroku.com to middleware to simplify routes, and making middleware thread-safe via dup + _call.
AI-written summary · about
chapters (5)
- 0:00Start
- 20:47Middleware can simplify your application
- 22:47Middleware can protect your application
- 23:28Middleware sees both the request & response object
- 24:24Middleware can be a code sharing mechanism








