Cloudflare Worker反向代理525错误

https://blog.hzchu.top/ 2026-10-27 21:40:42 累计浏览 117 次

表现

Cloudflare Worker内通过fetch()访问某些网站时出现525 SSL证书握手错误,且仅在自定义域名(Zone)下存在该问题,通过默认workers.dev访问时,worker不会出错

修复

关闭该Zone下SSL/TLS下的“后量子混合”

扩展

“后量子混合”将只发送后量子算法X25519MLKEM768,不支持的后端将握手失败,使用以下命令测试

  1. 编译bssl
# 安装编译依赖
sudo apt install -y cmake ninja-build build-essential
git clone https://github.com/google/boringssl.git
cd boringssl

# 编译
cmake -GNinja -B build -DCMAKE_BUILD_TYPE=Release
ninja -C build bssl

# 构建产物输出在build/
  1. 执行测试
./bssl client -connect <YOUR_ORIGIN>:443 -curves X25519MLKEM768

参考输出:

aaa@aaa:~/boringssl-0.20260813.0/build$ ./bssl client -connect chat.deepseek.com:443 -curves X25519MLKEM768
Connecting to 116.205.40.114:443
Error while connecting: SSLV3_ALERT_HANDSHAKE_FAILURE
96303410904544:error:10000410:SSL routines:OPENSSL_internal:SSLV3_ALERT_HANDSHAKE_FAILURE:/home/aaa/boringssl-0.20260813.0/ssl/tls_record.cc:491:SSL alert number 40
96303410904544:error:1000009a:SSL routines:OPENSSL_internal:HANDSHAKE_FAILURE_ON_CLIENT_HELLO:/home/aaa/boringssl-0.20260813.0/ssl/handshake.cc:591:
aaa@aaa:~/boringssl-0.20260813.0/build$ ./bssl client -connect www.cloudflare.com:443 -curves X25519MLKEM768
Connecting to [2606:4700::6810:7b60]:443
Connected.
  Version: TLSv1.3
  Resumed session: no
  Cipher: TLS_AES_128_GCM_SHA256
  ECDHE group: X25519MLKEM768
  Signature algorithm: ecdsa_secp256r1_sha256
  Secure renegotiation: yes
  Extended master secret: yes
  Next protocol negotiated: 
  ALPN protocol: 
  OCSP staple: no
  SCT list: no
  Early data: no
  Encrypted ClientHello: no
  Cert subject: CN = www.cloudflare.com
  Cert issuer: C = US, O = Google Trust Services, CN = WE1
  
# 2026/09/22

可见,对于chat.deepseek.com,国内CDN的配置不支持该加密算法

  1. X25519MLKEM768,指椭圆曲线算法X25519和后量子密码算法ML-KEM-768的组合,同时称为混合密钥交换,保证即便其中一个算法出现问题,也足以保证安全
  2. 后量子密码算法通过格密码实现

参考

  1. Post-quantum between Cloudflare and origin servers · Cloudflare SSL/TLS docs
  2. 后量子密码学 - 维基百科
  3. TLS 1.3 Hybrid Key Exchange using X25519Kyber768 / ML-KEM

同分类推荐文章

  1. 全盘加密应对的威胁模型、分层设计与实践 (2026-11-14 03:10:02)
  2. 别了,SMTP mTLS (2026-11-14 00:10:02)
  3. Stop Writing Authentication Checks Into Every Service. Combine Them in your Kubernetes Gateway. (2026-10-27 13:40:42)

查看更多 安全 文章 →

建议继续学习

  1. TLS 握手优化详解 (累计阅读 3,430)
  2. Post-Quantum Cryptography (PQC) support in NGINX (累计阅读 160)
  3. 学习笔记 | 简单设计一个OAuth认证回调服务器 (累计阅读 160)
  4. Encrypted Client Hello Comes to NGINX (累计阅读 146)