XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
24.47k stars 3.83k forks source link

SplitHTTP 不能使用 cloudflared 的 argo 隧道 #3478

Closed fscarmen closed 2 months ago

fscarmen commented 2 months ago

完整性要求

版本

1.8.16

描述

SplitHTTP 不能使用 cloudflared 的 argo 隧道接入,服务端 cloudflared 和 xray 都有请求进来

重现方式

xray 服务端入站

{
  "inbounds": [
    {
      "tag": "VLESS-SplitHTTP",
      "port": 2052,
      "listen": "0.0.0.0",
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "78367ffd-9f99-4a95-8185-afcded0beadf"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "splithttp",
        "splithttpSettings": {
            "path": "/78367ffd-9f99-4a95-8185-afcded0beadf"
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ]
}

v2rayN V6.48 配置,及测服务器速度截图

image image

xray 日志截图,每次测速有一条请求

image

cloudflare 日志截图,每次测速有一条请求

image

客户端配置



服务端配置


{
  "inbounds": [
    {
      "tag": "VLESS-SplitHTTP",
      "port": 2052,
      "listen": "0.0.0.0",
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "78367ffd-9f99-4a95-8185-afcded0beadf"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "splithttp",
        "splithttpSettings": {
            "path": "/78367ffd-9f99-4a95-8185-afcded0beadf"
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ]
}

客户端日志


C:\v2rayN-With-Core\guiConfigs\configSpeedtest.json
Xray 1.8.16 (Xray, Penetrates Everything.) 9432a60 (go1.22.4 windows/amd64)
A unified platform for anti-censorship.
2024/06/27 18:56:49 [Info] infra/conf/serial: Reading config: configSpeedtest.json
2024/06/27 18:56:49 [Warning] core: Xray 1.8.16 started
2024/06/27 18:56:50 127.0.0.1:50086 accepted //speed.cloudflare.com:443 [http10829 -> proxy10829]
2024/06/27 18:57:00 测试完成
2024/06/27 18:59:14 127.0.0.1:50096 accepted //www.google.com:443 [http -> proxy]
2024/06/27 18:59:14 当前服务的真连接延迟: -1 ms

服务端日志


2024/06/27 18:55:58 12*.***.***.184:0 accepted tcp:speed.cloudflare.com:443 [VLESS-SplitHTTP >> direct]
2024/06/27 18:56:14 12*.***.***.184:0 accepted tcp:speed.cloudflare.com:443 [VLESS-SplitHTTP >> direct]
2024/06/27 18:56:42 12*.***.***.184:0 accepted tcp:speed.cloudflare.com:443 [VLESS-SplitHTTP >> direct]
mmmray commented 2 months ago

In general, when you see a hanging connection with splithttp, try this (when path=/):

curl -vN https://myserver.com/fakesessionid/

this should print 200 OK, and then hang.

if it does not print 200 OK (but instead just hangs), then responses are not streaming, and there is an issue with response buffering. You need to somehow disable response buffering.

according to this issue, there may be an issue with argo and response buffering.

some useful google searches:

I recommend to install nginx between xray and cloudflare, and try some workarounds from the linked cloudflared issue. This response header probably works:

        add_header Content-Type text/event-stream;

If any of them are successful, it can be added to xray.

fscarmen commented 2 months ago
image

It does not print 200 OK and hang for a minute.

root@aezx:~# curl -v http://irs-soap-berkeley-imposed.trycloudflare.com/78367ffd-9f99-4a95-8185-afcded0beadf/78367ffd-9f99-4a95-8185-afcded0beadf
*   Trying [2606:4700::6810:e784]:80...
* Connected to irs-soap-berkeley-imposed.trycloudflare.com (2606:4700::6810:e784) port 80 (#0)
> GET /78367ffd-9f99-4a95-8185-afcded0beadf/78367ffd-9f99-4a95-8185-afcded0beadf HTTP/1.1
> Host: irs-soap-berkeley-imposed.trycloudflare.com
> User-Agent: curl/7.88.1
> Accept: */*
> 
< HTTP/1.1 524 
< Date: Thu, 27 Jun 2024 12:31:20 GMT
< Content-Type: text/html; charset=UTF-8
< Content-Length: 7262
< Connection: keep-alive
< CF-Ray: 89a571a83c7c8d78-HEL
< Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Expires: Thu, 01 Jan 1970 00:00:01 GMT
< Referrer-Policy: same-origin
< X-Frame-Options: SAMEORIGIN
< Server: cloudflare
< 
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>

<title>irs-soap-berkeley-imposed.trycloudflare.com | 524: A timeout occurred</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" />

</head>
<body>
<div id="cf-wrapper">
    <div id="cf-error-details" class="p-0">
        <header class="mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-8">
            <h1 class="inline-block sm:block sm:mb-2 font-light text-60 lg:text-4xl text-black-dark leading-tight mr-2">
              <span class="inline-block">A timeout occurred</span>
              <span class="code-label">Error code 524</span>
            </h1>
            <div>
               Visit <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_524&utm_campaign=irs-soap-berkeley-imposed.trycloudflare.com" target="_blank" rel="noopener noreferrer">cloudflare.com</a> for more information.
            </div>
            <div class="mt-3">2024-06-27 12:31:20 UTC</div>
        </header>
        <div class="my-8 bg-gradient-gray">
            <div class="w-240 lg:w-full mx-auto">
                <div class="clearfix md:px-8">

<div id="cf-browser-status" class=" relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">

    <span class="cf-icon-browser block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>

  </div>
  <span class="md:block w-full truncate">You</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">

    Browser

  </h3>
  <span class="leading-1.3 text-2xl text-green-success">Working</span>
</div>

<div id="cf-cloudflare-status" class=" relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">
    <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_524&utm_campaign=irs-soap-berkeley-imposed.trycloudflare.com" target="_blank" rel="noopener noreferrer">
    <span class="cf-icon-cloud block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
    </a>
  </div>
  <span class="md:block w-full truncate">Helsinki</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">
    <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_524&utm_campaign=irs-soap-berkeley-imposed.trycloudflare.com" target="_blank" rel="noopener noreferrer">
    Cloudflare
    </a>
  </h3>
  <span class="leading-1.3 text-2xl text-green-success">Working</span>
</div>

<div id="cf-host-status" class="cf-error-source relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">

    <span class="cf-icon-server block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-error w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>

  </div>
  <span class="md:block w-full truncate">irs-soap-berkeley-imposed.trycloudflare.com</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">

    Host

  </h3>
  <span class="leading-1.3 text-2xl text-red-error">Error</span>
</div>

                </div>
            </div>
        </div>

        <div class="w-240 lg:w-full mx-auto mb-8 lg:px-8">
            <div class="clearfix">
                <div class="w-1/2 md:w-full float-left pr-6 md:pb-10 md:pr-0 leading-relaxed">
                    <h2 class="text-3xl font-normal leading-1.3 mb-4">What happened?</h2>
                    <p>The origin web server timed out responding to this request.</p>
                </div>
                <div class="w-1/2 md:w-full float-left leading-relaxed">
                    <h2 class="text-3xl font-normal leading-1.3 mb-4">What can I do?</h2>
                          <h3 class="text-15 font-semibold mb-2">If you're a visitor of this website:</h3>
      <p class="mb-6">Please try again in a few minutes.</p>

      <h3 class="text-15 font-semibold mb-2">If you're the owner of this website:</h3>
      <p><span>The connection to the origin web server was made, but the origin web server timed out before responding. The likely cause is an overloaded background task, database or application, stressing the resources on your web server. To resolve, please work with your hosting provider or web development team to free up resources for your database or overloaded application.</span> <a rel="noopener noreferrer" href="https://support.cloudflare.com/hc/en-us/articles/200171926-Error-524">Additional troubleshooting information here.</a></p>
                </div>
            </div>
        </div>

        <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
  <p class="text-13">
    <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">89a571a860bb8d78</strong></span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span id="cf-footer-item-ip" class="cf-footer-item hidden sm:block sm:mb-1">
      Your IP:
      <button type="button" id="cf-footer-ip-reveal" class="cf-footer-ip-reveal-btn">Click to reveal</button>
      <span class="hidden" id="cf-footer-ip">2a01:4f9:4b:10c4::6e</span>
      <span class="cf-footer-separator sm:hidden">&bull;</span>
    </span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_524&utm_campaign=irs-soap-berkeley-imposed.trycloudflare.com" id="brand_link" target="_blank">Cloudflare</a></span>

  </p>
  <script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script>
</div><!-- /.error-footer -->

    </div>
</div>
</body>
</html>
* Connection #0 to host irs-soap-berkeley-imposed.trycloudflare.com left intact
*
mmmray commented 2 months ago

@fscarmen https://github.com/XTLS/Xray-core/pull/3479

can you test this version on the server?

I don't have the ability to test CF argo right now

fscarmen commented 2 months ago

@fscarmen #3479

can you test this version on the server?

I don't have the ability to test CF argo right now

The latest commit is working fine, thanks for doing it.