修复跨域问题

This commit is contained in:
2026-04-14 12:50:02 +08:00
parent bf5b2516e2
commit a29b3f0711
4 changed files with 26 additions and 3 deletions

View File

@@ -49,6 +49,10 @@ class AuthMiddleware(BaseHTTPMiddleware):
"""JWT认证中间件"""
async def dispatch(self, request: Request, call_next):
# OPTIONS 预检请求跳过认证
if request.method == "OPTIONS":
return await call_next(request)
path = request.url.path
# 公开路径跳过认证