Closed Icarusradio closed 3 years ago
建议先用新机器直接下载caddy2测试
potentially fixed in #164, check latest version here: https://guide.v2fly.org/advanced/wss_and_web.html#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE
potentially fixed in #164, check latest version here: https://guide.v2fly.org/advanced/wss_and_web.html#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE
thanks, a very good example of caddyfile btw, you missed the asterrisks. https://caddy.community/t/caddy-v2-how-to-proxy-websoket-v2ray-websocket-tls/7040/12 https://caddyserver.com/docs/caddyfile/matchers
Is the following line required in the block of reverse_proxy?
header_up -Origin
potentially fixed in #164, check latest version here: https://guide.v2fly.org/advanced/wss_and_web.html#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE
这个是wss的,http2+tls+web的那个网页里把caddy1的caddyfile改成caddy2的caddyfile之后就会出现问题,请问怎么办呢
折腾半天测试了没有问题 caddy: v2.3.0 v2ray 4.37.3
Caddyfile
my.com {
reversy_proxy /path 127.0.0.1:2333 {
transport http {
compression off
versions h2c 2
}
}
root * /path/to/www
file_server
}
config.json
{
"log": {
"loglevel": "debug"
},
"inbounds": [
{
"port": 2333,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [{"id": "<client_uuic>"}],
"decryption": "none"
},
"streamSettings": {
"network": "h2",
"httpSettings": {
"paht": "/path",
"host": [
"my.com",
]
},
"security": "none"
}
}
],
"outbounds": [{"protocol": "freedom", "settings": {}}]
}
compression off
是为了提高性能,后端传输数据没必要压缩
versions h2c 2
这个请参考 官方文档 提到:
versions allows customizing which versions of HTTP to support. As a special case, "h2c" is a valid value which will enable cleartext HTTP/2 connections to the upstream (however, this is a non-standard feature that does not use Go's default HTTP transport, so it is exclusive of other features; subject to change or removal). Default: 1.1 2, or if scheme is h2c://, h2c 2
h2c
并没有使用 golang 的标准库实现,未来可能会更改或移除(?) 所以如果不想用h2c的话可以在v2ray中开启tls,并配置好证书(caddy管理的证书默认在$HOME/.local/share/caddy
里)
如有错请指正,希望能帮到你
谢谢,我之前参考 v2ray-examples 已经成功了。不过谢谢提示可以去掉压缩提升性能。
最近试了一下把 Caddy 1 的配置文件改为 Caddy 2,但是发现没有成功,查看日志不知道问题出在哪里。
修改的 Caddy 2 配置,参数参考了这里,这里直接用 Caddy 来管理证书
服务端 V2Ray 配置(略去了其余配置)
客户端的配置(略去了其余配置)
目前遇到的问题是客户端日志显示 timeout,服务端没有日志。当客户端 V2Ray 关闭时,服务端才会出现日志 Caddy 日志
V2Ray 服务端日志