如何解决Cloudflare错误525如果尝试通过https端口连接websocket
我目前正在尝试测试基于websocket的php聊天。 https://github.com/sanwebe/Chat-Using-WebSocket-and-PHP-Socket
这是我目前正在尝试测试的内容。 但是我正在使用cloudflare,通常使用cloudflare应该可以正常工作,但我总是得到
Error 525
SSL handshake failed
当我尝试像这样访问它时: https://example.com:2096/chat/server.php
&同样的结果,如果我尝试使用chat ofc。但这适用于使用https端口的每个域,以及8443个相同的结果,等等。
我正在使用“完全(严格)”模式,并且已经安装了cloudflare安装的签名证书,所以我真的不知道问题出在哪里,使用wss并在禁用SSL时有效,但是我想使其可以通过SSL ofc进行工作。
在不使用https端口的情况下访问我的网站可以很好地工作,因此它不能是“严格”模式,不能测试正常的“完全”和灵活但结果相同。
非常感谢您的帮助。
编辑-
config (site infinite loading)
解决方法
通过在我的httpd-ssl.conf中添加它来解决该问题
SSLVerifyClient require
SSLVerifyDepth 1
SSLCACertificateFile "C:\xampp\apache\ssl\origin-pull-ca.pem"
SSLProxyEngine on
SSLProxyCACertificateFile "C:\xampp\apache\ssl\origin-pull-ca.pem"
RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule .* "ws://localhost:8443/$1" [P,L]
#Redirecting websocket traffic
ProxyPass /server ws://localhost:8443/server
ProxyPassReverse /server ws://localhost:8443/server
感谢Aviv Lo将他的时间浪费在帮助我一个多小时上!欣赏它。
,这可能是您错过了SSLProxyCACertificateFile
指令。
我正使用带有Nodejs的Socket.io从生产服务器中直接获取此配置。我认为这可能会有所帮助。
<VirtualHost *:443>
ServerName exmample.com
ServerAlias www.exmample.com
ServerAdmin admin@exmample.com
DocumentRoot /var/www/exmample.com
LogLevel debug ssl:info
SSLEngine on
SSLCertificateFile /path/to/cert
SSLCertificateKeyFile /path/to/key
SSLVerifyClient require
SSLVerifyDepth 1
SSLCACertificateFile /etc/apache2/ca/origin-pull-ca.pem
SSLProxyEngine on
SSLProxyCACertificateFile /etc/apache2/ca/origin-pull-ca.pem
RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule .* "wss:/localhost:2096/$1" [P,L]
#Redirecting websocket traffic
ProxyPass /shut / wss://localhost:2096/shut
ProxyPassReverse /shut wss://localhost:2096/shut
#Redirecting http traffic
ProxyPass / http://localhost:2096/shut
ProxyPassReverse / http://localhost:2096/shut
ErrorLog ${APACHE_LOG_DIR}/exmaple_error_https.log
CustomLog ${APACHE_LOG_DIR}/example_access_https.log combined
</VirtualHost>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。