From 44b2ba831f85fd647678aa6f9ed08e5608fc2d33 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sun, 29 Oct 2023 08:46:58 +0300 Subject: [PATCH] update cors --- apps/py-conveyor-service/main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/py-conveyor-service/main.py b/apps/py-conveyor-service/main.py index 88b37b5..d073b12 100644 --- a/apps/py-conveyor-service/main.py +++ b/apps/py-conveyor-service/main.py @@ -1,5 +1,6 @@ import uvicorn from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware from server.routers_init import all_routers @@ -8,6 +9,16 @@ app = FastAPI( docs_url='/api/docs' ) +origins = ["*"] + +app.add_middleware( + CORSMiddleware, + allow_origins=origins, + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + for router in all_routers: app.include_router(router)