Closed flowingcloud516 closed 3 years ago
ws://sample.com:443/ 配置路径错误了,更换成自己的
ws://sample.com:443/ 配置路径错误了,更换成自己的
这个路径在哪里改? 另外,如果是路径错误的话,讲道理 sample.com 换成 VPS 的IP也访问不了吧?
您是否真的有自己domain如sample.com?
您已修改dns a record到CDN地址?
修改完dns後等了多久?因要等ttl.
如已确定上面3点,试试修改dns a record 指到您v2ray server ip.
- 您是否真的有自己domain如sample.com?
- 您已修改dns a record到CDN地址?
- 修改完dns後等了多久?因要等ttl.
- 如已确定上面3点,试试修改dns a record 指到您v2ray server ip.
可能引起了你们的误会? 我是用 sample.com 替换了自己的域名 DNS record 已生效。从 dig 命令可以看出来 DNS不经过CDN,直接到VPS IP 是可以正常使用的。 CDN用的 cloudflare,状态已经 active
有几点想先了解 1。再看您server config是用端口443,但就没tls和没电子证书。只是用一般websocket 对吗?(还是只没放上来) 2。再看您的client config, 是有tls设定。 "tlsSettings": { "allowInsecure": true }, 3。 您是否已在cdn放入电子证书?
急速测试 走cdn 直接访问ws那个地址 报400就是成功接入. 服务端开了tls 不知道是否cf能接过去 cf他们会提供给你一个证书然后让cf节点到服务器加密访问. 其他证书不知道cf是否能验证通过. 总之直接访问地址就行了 没400就没法用. 服务端ws 的tls关了要是出现400那就正常了. 好了我走了.
急速测试 走cdn 直接访问ws那个地址 报400就是成功接入. 服务端开了tls 不知道是否cf能接过去 cf他们会提供给你一个证书然后让cf节点到服务器加密访问. 其他证书不知道cf是否能验证通过. 总之直接访问地址就行了 没400就没法用. 服务端ws 的tls关了要是出现400那就正常了. 好了我走了.
直接访问IP不报400。不论是以客户端的配置IP的方式,还是设置CDN直连,都可以正常使用。
有几点想先了解 1。再看您server config是用端口443,但就没tls和没电子证书。只是用一般websocket 对吗?(还是只没放上来) 2。再看您的client config, 是有tls设定。 "tlsSettings": { "allowInsecure": true }, 3。 您是否已在cdn放入电子证书?
1.只是一般的用websocket,没有加tls 2.tls设定是要关掉的意思?我理解 allowInsecure为true,应该是允许非安全访问的意思吧? 3.没设置。还没搞到tls这块来
急速测试 走cdn 直接访问ws那个地址 报400就是成功接入. 服务端开了tls 不知道是否cf能接过去 cf他们会提供给你一个证书然后让cf节点到服务器加密访问. 其他证书不知道cf是否能验证通过. 总之直接访问地址就行了 没400就没法用. 服务端ws 的tls关了要是出现400那就正常了. 好了我走了.
我想尝试一下服务端强制关闭tls,不知道应该怎么填参数?
参考: https://www.v2ray.com/chapter_02/05_transport.html
allowInsecure: true | false 是否允许不安全连接(用于客户端)。当值为true时,V2Ray 不会检查远端主机所提供的 TLS 证书的有效性。
解读: 说白点, 就是“是否用自签电子证书” 如您用的是“自签电子证书” allowInsecure: 就要true 如电子证书是由合法第三方发出,如CDN或let's encrypt, allowInsecure: 就可以false
参考: https://www.v2ray.com/chapter_02/05_transport.html
allowInsecure: true | false 是否允许不安全连接(用于客户端)。当值为true时,V2Ray 不会检查远端主机所提供的 TLS 证书的有效性。
解读: 说白点, 就是“是否用自签电子证书” 如您用的是“自签电子证书” allowInsecure: 就要true 如电子证书是由合法第三方发出,如CDN或let's encrypt, allowInsecure: 就可以false
客户端设置成 "allowInsecure": false,依旧无效。 还有什么排查思路吗。。
您现在的问题 应由CDN开始,
您现在的问题 应由CDN开始,
- 首先看看您的CDN“有没冇用电子证书”
{ 补充中 }
CDN用的 cloudflare,但是不是很确定有没有关掉。 Crypto 里面有一项是 “Disable Universal SSL”,刚刚disable掉了,应该是关了吧?
如已关掉ssl, 就要留意cdn端口是否还是443
如已关掉ssl, 就要留意cdn端口是否还是443
平台上看不到CDN的端口。实在不知道这个怎么看。。。 刚刚观察了一下日志,如果直连IP,access.log 会打印访问日志,但是走CDN的话,访问日志也没有。会不会是CDN设置的问题?但是有什么办法验证这个猜想吗?
ws服务端配置好之后,直接访问ws的完整地址(ip或域名+path),应该是返回200代码,以及一个源码为“Bad Request”的网页。而不是返回400代码,因为400代码本身代表真正的“Bad Request”。
不走cdn能正常连接,说明服务器配置没毛病。
然而从cdn连接却得到一个400代码,讲道理,这是cdn的锅。缓存策略有问题?缓存没有及时更新?服务商压根不支持ws(据我所知支持ws的cdn服务商真的很少)? 喂,你用的cdn莫非不是cf?
我相信你是电子证书问题
如果你只是ws 不设 tls client server 两边都要 停tls. cf crypto ssl 就要off Client outgoing server incoming 都要设定 80
但 如果你要 ws+tls client server 两边都要enable tls. cf crypto ssl 就要Full(strict) Client outgoing server incoming 都要设定 443 Server那边还要设电子证书
在 CF Crypto设定电子证书
ssl - Full (strict)
Order SSL Certificate - Universal SSL 就可以
Origin Certificates - Create Certificate (之後会显示 crt 和 key, 这时要先copy出来save to file,因过後安全问题只能看见crt已没有key. 如真的没了, 只要删除旧电子证书再建立新的就可以。)
Always Use HTTPS - ON
Minimum TLS Version - TLS 1.2
TLS 1.3 - Enabled+0RTT
Automatic HTTPS Rewrites - Off
Others :
上面所提及的 是基於 要经过 CDN 所以一定一定要 ws port 80, ws+tls port 443. 到你成功连接後再一步一步往上推。 以下是 cf crypto 参考
https://www.johnrosen1.com/v2ray-cdn/ 你可以参考参考,tls推荐开启
我也遇到了相同的问题,一套cdn,v2ray就失效,有没有证书都一样,和证书无关,不知道楼主解决了没有呢?
@flowingcloud516 @yanlianglai 注意如果是 CloudFlare 的话,WebSocket 连接是默认关闭的。需要手动打开 Network 下面的 WebSocket 开关,如下图所示:
还可以在自己的 VPS 上通过 wscat
命令验证 CloudFlare 配置的正确性:
$ sudo apt install node-ws
$ wscat -c ws://127.0.0.1:你的端口
connected (press CTRL+C to quit)
# 配置好 CloudFlare 之前
$ wscat -c wss://你的域名/你的path
error: Error: unexpected server response (400)
# 配置好 CloudFlare 之后
$ wscat -c wss://你的域名/你的path
connected (press CTRL+C to quit)
我也遇到了相同的问题,一套cdn,v2ray就失效,有没有证书都一样,和证书无关,不知道楼主解决了没有呢?
一样,所以现在只能不套CDN裸奔了
我也遇到了相同的问题,一套cdn,v2ray就失效,有没有证书都一样,和证书无关,不知道楼主解决了没有呢?
如果主机端口是 443,打开 TLS 并且配置了证书
需要在 CloudFlare 上将 SSL/TLS encryption mode 改为 Full (strict),再打开 Always Use HTTPS,基本就能解决了
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
CF上如果要使用自己的SSL证书 收费好贵,所以是不是意味着 如果要套CDN,就不能用tls了。。。
@flowingcloud516 @yanlianglai 注意如果是 CloudFlare 的话,WebSocket 连接是默认关闭的。需要手动打开 Network 下面的 WebSocket 开关,如下图所示:
还可以在自己的 VPS 上通过
wscat
命令验证 CloudFlare 配置的正确性:$ sudo apt install node-ws $ wscat -c ws://127.0.0.1:你的端口 connected (press CTRL+C to quit) # 配置好 CloudFlare 之前 $ wscat -c wss://你的域名/你的path error: Error: unexpected server response (400) # 配置好 CloudFlare 之后 $ wscat -c wss://你的域名/你的path connected (press CTRL+C to quit)
正解,解决了我一个长期烦恼!
@flowingcloud516 @yanlianglai 注意如果是 CloudFlare 的话,WebSocket 连接是默认关闭的。需要手动打开 Network 下面的 WebSocket 开关,如下图所示:
还可以在自己的 VPS 上通过
wscat
命令验证 CloudFlare 配置的正确性:$ sudo apt install node-ws $ wscat -c ws://127.0.0.1:你的端口 connected (press CTRL+C to quit) # 配置好 CloudFlare 之前 $ wscat -c wss://你的域名/你的path error: Error: unexpected server response (400) # 配置好 CloudFlare 之后 $ wscat -c wss://你的域名/你的path connected (press CTRL+C to quit)
试了一晚上,终于解决了!
我的情况刚好相反,我之前配置的是ws+tls, 我在v2ray的客户端配置里访问地址直接写的VPS的IP,访问都很快。但是最近突然不行了,v2ray无法连接了,然后我在访问的地址里修改为伪装的网页URL,可以访问,但是访问非常慢。我ping伪装的网站URL地址并不是我的VPS的IP(我猜是fc的CDN的IP),延迟非常高,然后我在FC的DNS设置里把proxy去掉,修改为DNS Only,我的V2ray就无法使用了。所以我想问的话我一定要使用FC的CDN么? 但是感觉这样子非常慢,twitter的图片都无法加载,更别说视频了,之前视频都非常流畅。 这里面到底是什么原因呢?
主机IP被封了
我的情况刚好相反,我之前配置的是ws+tls, 我在v2ray的客户端配置里访问地址直接写的VPS的IP,访问都很快。但是最近突然不行了,v2ray无法连接了,然后我在访问的地址里修改为伪装的网页URL,可以访问,但是访问非常慢。我ping伪装的网站URL地址并不是我的VPS的IP(我猜是fc的CDN的IP),延迟非常高,然后我在FC的DNS设置里把proxy去掉,修改为DNS Only,我的V2ray就无法使用了。所以我想问的话我一定要使用FC的CDN么? 但是感觉这样子非常慢,twitter的图片都无法加载,更别说视频了,之前视频都非常流畅。 这里面到底是什么原因呢?
你是主机IP被封了,只能换IP,或忍受FC的高延迟
正确原因是 nginx里面要配置上 tls3.0 ,很多教程都只配到了2.0,而cloudflare默认是用的tls3.0 从而导致无法访问,nginx里面加上这个就行了。
@flowingcloud516 @yanlianglai 注意如果是 CloudFlare 的话,WebSocket 连接是默认关闭的。需要手动打开 Network 下面的 WebSocket 开关,如下图所示:
还可以在自己的 VPS 上通过
wscat
命令验证 CloudFlare 配置的正确性:$ sudo apt install node-ws $ wscat -c ws://127.0.0.1:你的端口 connected (press CTRL+C to quit) # 配置好 CloudFlare 之前 $ wscat -c wss://你的域名/你的path error: Error: unexpected server response (400) # 配置好 CloudFlare 之后 $ wscat -c wss://你的域名/你的path connected (press CTRL+C to quit)
请问一下,这是什么情况,需要继续往哪里排查下?现在套上cdn还是不通,直连是ok的。(v2ray的端口实际在运行的)
提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。 如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用Discussion进行讨论。
1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) server 4.19.1 client 4.19.1
2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 登录 facebook
3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 直连IP可以正常访问,开启CDN后一直400,然后 trial fail
4) 你期待看到的正确表现是怎样的?
5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。
服务器端配置:
客户端配置: 客户端用的 V2RayU,配置文件似乎是自动生成的
6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在
/var/log/v2ray/error.log
文件中。服务器端错误日志:
客户端错误日志:
7) 请附上访问日志。在 Linux 中,日志通常在
/var/log/v2ray/access.log
文件中。8) 其它相关的配置文件(如 Nginx)和相关日志。 没有配置 nginx
9) 如果 V2Ray 无法启动,请附上
--test
输出。通常的命令为
/usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json
。请按实际情况修改。 v2ray 正常10) 如果 V2Ray 服务运行不正常,请附上 journal 日志。
通常的命令为
journalctl -u v2ray
。请预览一下你填的内容再提交。