This commit is contained in:
Timothy Jaeryang Baek committed 2026-06-14 09:11:15 +02:00
1 parent 0086c32745
commit a27fbb80e5
5 files changed
+113 -3

No files matched your search

+12
View File
@@ -128,6 +128,18 @@ from cptr.utils.proxy_middleware import ProxyFallbackMiddleware
app.add_middleware(ProxyFallbackMiddleware)
# CORS middleware: uses CPTR_CORS_ALLOWED_ORIGINS env var (default "*").
from fastapi.middleware.cors import CORSMiddleware
from cptr.env import CORS_ALLOWED_ORIGINS
app.add_middleware(
CORSMiddleware,
allow_origins=CORS_ALLOWED_ORIGINS if isinstance(CORS_ALLOWED_ORIGINS, list) else ["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Path normalization middleware (Windows: \ → / in JSON responses)
import platform