我正在使用XAMPP(使用Apache)在本地运行Web服务器(WordPress),并使用Cloudflared隧道将其转发到我的Cloudflared托管域。在通过域连接时,我遇到了证书问题。
我有一个从Cloudflare收到的证书,它对我安装在XAMPP的证书位置的域有效,我知道它是与HTTPS结果一起发送的。另外,我在Cloudflare上的"SSL/TLS加密模式"是"完全(严格)"。
当从浏览器连接时,我得到一个502 Bad Gateway错误,Cloudflared打印此错误:error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: x509: certificate is valid for *.example.com, example.com, not localhost
其中example.com
是我的域。
如果我去
http://example.com
或https://example.com
,我得到上面的错误。http://localhost
,则网站加载但不加载任何资源,因为WordPress通过查询域https://example.com/path/to/resource
来加载资源。https://localhost
,和上面发生的一样,但是Chrome也给我一个警告,证书无效。
以下是Cloudflared的config.yml
中的入口规则。
ingress:
- hostname: ssh.example.com # I haven't gotten this one to work yet.
service: ssh://localhost:22
- hostname: example.com # This is the one having a problem.
service: https://localhost
- service: https://localhost
我相信发生的是Cloudflared收到对我的域有效的证书(*. www.example.com,example.com),然后尝试通过转到https://localhost
来执行入口规则,example.com(对localhost
有效),以及Cloudflared在尝试执行涉及www.example.com的入口规则时检查的另一个(对example.com
有效)。如果是这样,我该怎么做? but the certificate is not valid for localhost
. I don't think I should just get a certificate which is valid for localhost
AND example.com
. Do I need one certificate (valid for localhost
) to be returned whenever http(s)://localhost
is called and another (valid for example.com
) that Cloudflared checks when it tries to execute an ingress rule involving example.com? If so, how do I do this?
1条答案
按热度按时间daolsyd01#
我通过使用Cloudflared的
config.yml
中的noTLSVerify
选项解决了这个问题。当客户端连接到我的域时,它会像这样:客户端〉Cloudflare〉在我的机器上运行的Cloudflare示例〉Origin(碰巧也是我的机器:
https://localhost
)Origin发回的证书对于Cloudflared访问它的地址
localhost
无效,但是通过将这些行添加到config.yml
,我认为Cloudflare不检查从源接收的证书,尽管它仍然将证书返回给Cloudflare,由它根据我的域进行检查。