Skip to content

Commit 091aa47

Browse files
committed
allow cors
1 parent 52cce19 commit 091aa47

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/stale-forks-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@e2b/code-interpreter-template': patch
3+
---
4+
5+
allow cors

template/server/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from contextlib import asynccontextmanager
88
from fastapi import FastAPI, Request
9+
from fastapi.middleware.cors import CORSMiddleware
910
from fastapi.responses import PlainTextResponse
1011

1112
from api.models.context import Context
@@ -60,6 +61,14 @@ async def lifespan(app: FastAPI):
6061

6162
app = FastAPI(lifespan=lifespan)
6263

64+
app.add_middleware(
65+
CORSMiddleware,
66+
allow_origins=["*"],
67+
allow_credentials=True,
68+
allow_methods=["*"],
69+
allow_headers=["*"],
70+
)
71+
6372
logger.info("Starting Code Interpreter server")
6473

6574

0 commit comments

Comments
 (0)