Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stale-forks-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@e2b/code-interpreter-template': patch
---

allow cors
9 changes: 9 additions & 0 deletions template/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from contextlib import asynccontextmanager
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import PlainTextResponse

from api.models.context import Context
Expand Down Expand Up @@ -58,8 +59,16 @@
raise


app = FastAPI(lifespan=lifespan)

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
Comment thread
mishushakov marked this conversation as resolved.
Outdated
allow_methods=["*"],
allow_headers=["*"],

Check failure on line 69 in template/server/main.py

View check run for this annotation

Claude / Claude Code Review

Invalid CORS config: wildcard origin with credentials=True

The CORS middleware combines `allow_origins=["*"]` with `allow_credentials=True`, which is invalid per the CORS specification — browsers reject responses that send both `Access-Control-Allow-Origin: *` and `Access-Control-Allow-Credentials: true` for credentialed requests. Since authentication uses a custom `X-Access-Token` header (not a browser credential), `allow_credentials=True` is unnecessary and should be removed so the wildcard origin setting works correctly.
)
Comment thread
mishushakov marked this conversation as resolved.
Comment thread
mishushakov marked this conversation as resolved.

logger.info("Starting Code Interpreter server")


Expand Down
Loading