最近尝试用 Cloudflare 来把家里的服务代理出来,实现 443->10443 这种标准端口到非标准端口的转换(某些服务用标准端口方便一些)。然后使用 Cloudflare 自己的域名时,访问正常,但是一旦使用自己的域名,则报 Plain HTTP request was sent to HTTPS port。

下图为后端 Nginx 返回的日志,Nginx 侧也开启了 TLS:


使用 Cloudflare worker 做反向代理时报 The plain HTTP request was sent to HTTPS port_Nginx

此原因和 Cloudflare 自己的服务有关系,查了下在下列位置开启 SSL Full encryption mode 模式即可:

使用 Cloudflare worker 做反向代理时报 The plain HTTP request was sent to HTTPS port_HTTPS_02

使用 Cloudflare worker 做反向代理时报 The plain HTTP request was sent to HTTPS port_Nginx_03

参考文档:

https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/full/