Rate Limits and Security Headers

A sign-in route that answers every guess lets a script try thousands of passwords, so a rate limit counts each address's tries in a window of time and answers 429 with Retry-After, slowapi puts one on a FastAPI route, and a small middleware adds security headers to every answer.

By

Updated

Cheat sheet: Rate Limits and Security Headers
Category
FastAPI
Level
Journeyman
Tags
429 Too Many Requests, fastapi, Rate Limiting, Security Headers, slowapi, web-development