Fast API Tutorial, Part 28: Middleware and CORS

preview_player
Показать описание
It may seem a bit like the way that FastAPI uses dependency injection can feel a bit like a middleware. Well, FastAPI also allows for adding middlewares explicitly.

In this video I show you how you can use some built-in middleware functionality as well as handle CORS via the CORSMiddleware package.

Рекомендации по теме
Комментарии
Автор

What about csrf_tokens do these need to be handled also? I know in django it is quite easy with {% csrf_token %} but what about for fastapi?

clearthinking
Автор

need a help, lets say my api is deployed on aks.. my localhost fast api works fine with localhost webapp. but the deployed one is not working with localhost webapp due to cors issue. Added origin localhost to cors middleware, still no luck
how to fix that

srujanashankar
Автор

do you know why i have "blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status." on my "POST" request ?

alfannurchamid
join shbcf.ru