Glossary coding Term Page
Trusted Host
Host header allowlist that blocks requests claiming unauthorized domains.
Core Idea
Trusted host enforcement inspects the HTTP Host header and rejects requests whose value is not on the approved list. This stops Host header attacks that could poison caches or bypass virtual host routing.
Why It Matters Here
Starlette’s TrustedHostMiddleware gives FastAPI a single place to define allowed domains, complementing security headers and rate limiting. Treat it like an access control list that filters bogus domains before more expensive work runs.