diff --git a/app/Protocols/Clash.php b/app/Protocols/Clash.php index ca649af..ea107c0 100644 --- a/app/Protocols/Clash.php +++ b/app/Protocols/Clash.php @@ -159,10 +159,12 @@ class Clash implements ProtocolInterface switch (data_get($protocol_settings, 'network')) { case 'tcp': $array['network'] = data_get($protocol_settings, 'network_settings.header.type'); - $array['http-opts'] = [ - 'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'), - 'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])) - ]; + if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') { + $array['http-opts'] = [ + 'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'), + 'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])) + ]; + } break; case 'ws': $array['network'] = 'ws'; diff --git a/app/Protocols/ClashMeta.php b/app/Protocols/ClashMeta.php index 8153880..941a031 100644 --- a/app/Protocols/ClashMeta.php +++ b/app/Protocols/ClashMeta.php @@ -158,10 +158,12 @@ class ClashMeta implements ProtocolInterface switch (data_get($protocol_settings, 'network')) { case 'tcp': $array['network'] = data_get($protocol_settings, 'network_settings.header.type', 'tcp'); - $array['http-opts'] = [ - 'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'), - 'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']), 1) - ]; + if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') { + $array['http-opts'] = [ + 'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'), + 'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])) + ]; + } break; case 'ws': $array['network'] = 'ws';