From dd3864db1f77363b7ac4133f335bfb270a9bc1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=B1=BC=E5=BC=80=E5=8F=91?= Date: Tue, 19 May 2026 11:36:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CORS=20=E9=85=8D=E7=BD=AE=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20Windows=20Tauri=20=E7=94=9F=E4=BA=A7=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20origin=20http://tauri.localhost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python-api/.env.example | 2 +- python-api/app/config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python-api/.env.example b/python-api/.env.example index 2c6e920..c6a12b8 100644 --- a/python-api/.env.example +++ b/python-api/.env.example @@ -36,7 +36,7 @@ ALGORITHM=HS256 # === CORS 配置 === # 本地开发: 允许 localhost # 测试/生产服: 填写实际域名,如 https://app.yourdomain.com -CORS_ORIGINS=http://localhost:1420,http://127.0.0.1:1420,http://localhost:8080 +CORS_ORIGINS=http://localhost:1420,http://127.0.0.1:1420,http://localhost:8080,tauri://localhost,http://tauri.localhost # === AI 平台配置 === diff --git a/python-api/app/config.py b/python-api/app/config.py index b2bb282..05c41e4 100644 --- a/python-api/app/config.py +++ b/python-api/app/config.py @@ -88,7 +88,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,tauri://localhost", + default="http://localhost:1420,http://127.0.0.1:1420,http://localhost:8080,http://127.0.0.1:8080,tauri://localhost,http://tauri.localhost", description="允许的跨域来源(逗号分隔)", )