Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 1816918

Browse files
Merge pull request #213 from stacklok/add-cors-middleware
Add CORS Middleware to FastAPI
2 parents a2946b8 + 305d9ed commit 1816918

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/codegate/server.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import List
22

33
from fastapi import APIRouter, FastAPI
4+
from fastapi.middleware.cors import CORSMiddleware
45

56
from codegate import __description__, __version__
67
from codegate.config import Config
@@ -34,6 +35,13 @@ def init_app() -> FastAPI:
3435
description=__description__,
3536
version=__version__,
3637
)
38+
app.add_middleware(
39+
CORSMiddleware,
40+
allow_origins=["*"],
41+
allow_credentials=True,
42+
allow_methods=["*"],
43+
allow_headers=["*"],
44+
)
3745

3846
# Initialize secrets manager
3947
# TODO: we need to clean up the secrets manager

0 commit comments

Comments
 (0)