v2ray / discussion

For general discussion over Project V development and usage.
298 stars 34 forks source link

目前是否可以实现vmess+H2C+caddy(v2)+tls不? #792

Closed lxhao61 closed 3 years ago

lxhao61 commented 4 years ago

caddy v1版官方已停止支持,目前已全部切换到v2版,从v2.1.0开始已支持H2C,目前最新版是v2.1.1。 v2ray从v4.20.0版就支持了H2C,目前最新版是v4.26.0。 那么是否可以实现vmess+H2C+caddy(v2)+tls,非之前vmess+H2+caddy(v1)。若可以实现,希望大神们告知,且提供配置模板,特别是caddy(v2)配置。谢谢! 另外若不能实现,那么是否可以实现vmess+H2+caddy(v2),其caddy(v2)配置怎样弄?谢谢! 上述相关信息如下: caddy官方网:https://caddyserver.com (已无v1版) caddy v2.1.0介绍(H2C支持):https://github.com/caddyserver/caddy/releases/tag/v2.1.0 v2ray v4.20.0 介绍(H2C支持): https://github.com/v2ray/v2ray-core/releases/tag/v4.20.0 vmess+H2+caddy(v1)模板:https://github.com/veekxt/v2ray-template/tree/master/H2%2Bvmess%2BCaddy

darhwa commented 4 years ago

官方最新的v2.1.1 release還不能跟v2ray一起工作,h2與h2c都不行。但是 https://github.com/caddyserver/caddy/commit/e9b1d7dcb4cbf85da7fb4cf8c411a4f840a98cf1 已經修正這個問題。目前使用需要自己編譯master,或者等v2.1.2發佈。h2c相關配置見下:

Caddyfile:

...

reverse_proxy /YOUR_HIDDEN_PATH 127.0.0.1:4689 {
  transport http {
    versions h2c
  }
}

...

或者json:

...

{
  "match" : [
    {
      "path" : [
        "/YOUR_HIDDEN_PATH"
      ]
    }
  ],
  "handle" : [
    {
      "handler" : "reverse_proxy",
      "upstreams" : [
        {
          "dial" : "127.0.0.1:4689"
        }
      ],
      "transport" : {
        "protocol" : "http",
        "versions" : [
          "h2c"
        ]
      }
    }
  ]
},

...
lxhao61 commented 4 years ago

明白了。万分感谢告知及提供caddy(v2)配置!

lxhao61 commented 4 years ago

折腾编译最新caddy2已弄好;但刚发现不必自己编译,其实caddy2源已编译了,下载即可。 具体地址:https://github.com/caddyserver/caddy/actions?query=workflow%3ATests 选一个最新编译的目录点击进入,根据自己系统下载对应包。

lxhao61 commented 4 years ago

目前 caddy2 的 v2.2.0-rc.1 版完美支持 v2ray 的 H2C了,可以实现 H2(HTTP/2) 应用。

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days