From 2937eb67664307183959ecbbb3f59afd4d76ee02 Mon Sep 17 00:00:00 2001 From: zerone0x Date: Mon, 13 Apr 2026 12:26:19 +0800 Subject: [PATCH] fix(proxy): remove permissive CORS layer (#1915) --- src-tauri/src/proxy/server.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src-tauri/src/proxy/server.rs b/src-tauri/src/proxy/server.rs index 8fa37edf..c6731252 100644 --- a/src-tauri/src/proxy/server.rs +++ b/src-tauri/src/proxy/server.rs @@ -23,7 +23,6 @@ use std::net::SocketAddr; use std::sync::Arc; use tokio::sync::{oneshot, RwLock}; use tokio::task::JoinHandle; -use tower_http::cors::{Any, CorsLayer}; /// 代理服务器状态(共享) #[derive(Clone)] @@ -275,11 +274,6 @@ impl ProxyServer { } fn build_router(&self) -> Router { - let cors = CorsLayer::new() - .allow_origin(Any) - .allow_methods(Any) - .allow_headers(Any); - Router::new() // 健康检查 .route("/health", get(handlers::health_check)) @@ -328,7 +322,6 @@ impl ProxyServer { .route("/gemini/v1beta/*path", post(handlers::handle_gemini)) // 提高默认请求体大小限制(避免 413 Payload Too Large) .layer(DefaultBodyLimit::max(200 * 1024 * 1024)) - .layer(cors) .with_state(self.state.clone()) }