Fast API Tutorial, Part 28: Middleware and CORS

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ม.ค. 2025

ความคิดเห็น • 8

  • @srujanashankar9517
    @srujanashankar9517 ปีที่แล้ว +2

    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

  • @clearthinking5441
    @clearthinking5441 ปีที่แล้ว

    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?

  • @alfannurchamid2952
    @alfannurchamid2952 2 ปีที่แล้ว

    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 ?

    • @JVPDesign
      @JVPDesign  2 ปีที่แล้ว

      What is your CORS setup in FastAPI? From what port are you trying to access the backend?

    • @agnesHQ
      @agnesHQ ปีที่แล้ว

      did you solve it? i have the same issue right now

    • @Sumitsinghdhalla
      @Sumitsinghdhalla ปีที่แล้ว +1

      @@agnesHQ Using a Proxy server(Nginx, etc) will solve this issue.

  • @RohitGulati-sl4xz
    @RohitGulati-sl4xz 2 ปีที่แล้ว

    For me, it shows the following : Unresolved attribute reference 'add_middleware' for class 'app'

    • @ayushanand18
      @ayushanand18 ปีที่แล้ว

      Did you initialise app = FastAPI()?