From 51b384e119da5fe725fcde7a61d2569f3a4c5d72 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Tue, 12 May 2026 09:10:22 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayN/issues/9277 --- .../Services/CoreConfig/V2ray/V2rayOutboundService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index f3836960..0cd35085 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -491,7 +491,6 @@ public partial class CoreConfigV2rayService //ws case nameof(ETransport.ws): WsSettings4Ray wsSettings = new(); - wsSettings.headers = new Headers4Ray(); if (host.IsNotEmpty()) { @@ -503,6 +502,7 @@ public partial class CoreConfigV2rayService } if (useragent.IsNotEmpty()) { + wsSettings.headers ??= new Headers4Ray(); wsSettings.headers.UserAgent = useragent; } streamSettings.wsSettings = wsSettings; @@ -522,6 +522,7 @@ public partial class CoreConfigV2rayService } if (useragent.IsNotEmpty()) { + httpupgradeSettings.headers ??= new Headers4Ray(); httpupgradeSettings.headers.UserAgent = useragent; } streamSettings.httpupgradeSettings = httpupgradeSettings;