fix: 修复 CORS allow_credentials 与 allow_origins=* 冲突
This commit is contained in:
+4
-4
@@ -65,10 +65,10 @@ app = FastAPI(title="md-vector-db", version="0.1.0", lifespan=lifespan)
|
||||
# CORS 中间件
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=os.environ.get("CORS_ORIGINS", "*").split(","),
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
allow_origins=os.environ.get("CORS_ORIGINS", "http://localhost:3000").split(","),
|
||||
allow_credentials=False,
|
||||
allow_methods=["GET", "POST", "DELETE", "OPTIONS"],
|
||||
allow_headers=["Content-Type", "Authorization", "X-API-Key"],
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user