steam-server/app/middleware/cors.py
2024-12-12 20:04:36 +08:00

13 lines
339 B
Python

# app/middleware/cors.py
from fastapi.middleware.cors import CORSMiddleware
def add_cors_middleware(app):
origins = ["*"] # 可以替换为更具体的来源
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)