Introduction
Middleware lets you add extra steps to handle web requests and responses. Custom middleware helps you add your own special rules or actions in your Django app.
You want to log every request made to your website.
You need to check user permissions before views run.
You want to modify response headers for all pages.
You want to measure how long each request takes.
You want to block certain IP addresses from accessing your site.