Results of 1 - 1 of about 1 for hosts (0.000 sec.)
- Advanced Middleware 9414
- Advanced Middleware Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In the main tutorial you read how to add Custom Middleware to your application. And then you al
...iddleware.trustedhost import TrustedHostMiddleware app = FastAPI () app . add_middleware ( TrustedHostMiddleware , allowed_hosts = [ "example.com" , "*.example.com" ] ) @app . get ( "/" ) async def main (): return { "message" : "Hello World" } The fol...lowing arguments are supported: allowed_hosts - A list of domain names that should be allowed as hostnames. Wildcard domains such as *.example.com are supported for mat...ching subdomains. To allow any hostname either use allowed_hosts=["*"] or omit the middleware. If an incoming request does not validate correctly then a 400 response will be sent. GZipMid... - https://man.mtool.work/fastapi/0.115/advanced/middleware/
PREV
1
NEXT