fix(cors): 后端 CORS 允许 Tauri 桌面应用 origin

添加 tauri://localhost 到 CORS_ORIGINS 默认值,
解决 Tauri WebView 请求被跨域拦截的问题
This commit is contained in:
小鱼开发
2026-05-10 21:10:11 +08:00
parent c7e8e89c22
commit fe3b378117
+1 -1
View File
@@ -92,7 +92,7 @@ class Settings(BaseSettings):
# CORS 配置
CORS_ORIGINS: str = Field(
default="http://localhost:1420,http://127.0.0.1:1420,http://localhost:8080,http://127.0.0.1:8080",
default="http://localhost:1420,http://127.0.0.1:1420,http://localhost:8080,http://127.0.0.1:8080,tauri://localhost",
description="允许的跨域来源(逗号分隔)",
)