在我们使用 CloudFlare CDN 的时候,对其 CDN 支持的一些端口不太熟悉。以为 CloudFlare 是只允许80/443端口走 CDN 的。其实不然,CloudFlare 有一些端口是允许 HTTP/HTTPS 流量走 CDN 的。默认情况下,Cloudflare 会代理发往下面列出的 HTTP/HTTPS 端口的流量。
Cloudflare 支持的 HTTP 端口:
- 80
- 8080
- 8880
- 2052
- 2082
- 2086
- 2095
Cloudflare 支持的 HTTPS 端口:
- 443
- 2053
- 2083
- 2087
- 2096
- 8443
Cloudflare 支持的端口,但禁用了缓存:
- 2052
- 2053
- 2082
- 2083
- 2086
- 2087
- 2095
- 2096
- 8880
- 8443
同时,中国数据中心内启用中国网络的域的 HTTP/HTTPS 流量,以及Cloudflare 应用程序的代理,只能使用80 和 443端口。
官网文档链接:https://developers.cloudflare.com/fundamentals/reference/network-ports/
如果您的域的流量要发送到上面列出的端口以外的其他端口,则可以:
- 通过您 Cloudflare DNS 页面添加子域为灰色云记录,或者
- 开启 Cloudflare Spectrum。
通过 WAF 规则 ID 100015 针对 Pro、Business 和 Enterprise 域阻止除 80 和 443 以外的其他端口上的流量:"Block requests to all ports except 80 and 443".
只有端口 80 和 443 可兼容以下服务:
- 对于启用了中国网络的域名的中国境内数据中心 HTTP/HTTPS 流量,
- Cloudflare Apps 代理,以及
- Cloudflare 缓存。Cloudflare Access 不支持 URL 中的端口号。 系统会从通过 Cloudflare Access 保护的 URL 请求中剥离端口号。