From 20d2e5629f26eeb906a22c4f84dc579a8e83c4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=ED=98=95=EC=A7=84?= Date: Tue, 19 Aug 2025 16:01:45 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20API=20=EC=97=B0=EA=B2=B0=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20CORS=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/main.py b/app/main.py index edd20be..1d0b2d1 100644 --- a/app/main.py +++ b/app/main.py @@ -6,6 +6,7 @@ from dotenv import load_dotenv from fastapi import FastAPI from fastapi.exceptions import RequestValidationError +from fastapi.middleware.cors import CORSMiddleware from starlette.middleware.base import BaseHTTPMiddleware from app.api import health_api @@ -46,6 +47,15 @@ def resource_path(relative_path: str) -> str: # 전체 로그 찍는 부분 app.add_middleware(BaseHTTPMiddleware, dispatch=log_requests_middleware) +# FIXME: CORS 설정 +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + # 전역 예외 처리기 등록 app.add_exception_handler(Exception, generic_exception_handler) app.add_exception_handler(APIException, api_exception_handler)