From c228bc2747279f0b75908aa9e48c3e133f1b3442 Mon Sep 17 00:00:00 2001 From: Ali Askari Date: Wed, 19 Feb 2025 15:04:38 +0330 Subject: [PATCH] fix: Host header problem in websocket transport --- bot/src/utils.rs | 5 +++++ singbox/src/protocol/mod.rs | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bot/src/utils.rs b/bot/src/utils.rs index 15041e3..624b31c 100644 --- a/bot/src/utils.rs +++ b/bot/src/utils.rs @@ -11,6 +11,11 @@ pub fn welcome_message() -> String { /singbox - Process URI for specific version 🔍 Supported versions: 1.11.0, 1.12.0 /xray comming soon ... + "We're currently in beta version ! + If you encounter any issues or have feedback, + please let us know + @ip_routes_admin + we appreciate your support!" "# .trim() .replace(" ", "") diff --git a/singbox/src/protocol/mod.rs b/singbox/src/protocol/mod.rs index f2b320f..a501ea7 100644 --- a/singbox/src/protocol/mod.rs +++ b/singbox/src/protocol/mod.rs @@ -401,7 +401,13 @@ fn parse_transport( } "ws" | "websocket" => Ok(transport::TransportConfig::Websocket { path: query.remove("path").unwrap_or_default(), - headers: parse_headers(query.remove("headers")), + headers: { + let mut headers = parse_headers(query.remove("headers")); + if let Some(host) = query.remove("host") { + headers.insert("Host".to_string(), host); + } + headers + }, max_early_data: query .remove("max_early_data") .and_then(|s| s.parse().ok())