我有:
- 我连接的 VPN 服务器 (SoftEther)。
- IP 表规则将所有流量从 VPN 发送到代理服务器。
- 代理服务器 (Java)。我使用 LittleProxy https://github.com/adamfisk/LittleProxy。它不会拦截 HTTPS 流量。
所有这些项目都是这样连接的:
VPN 客户端 ===> VPN 服务器 ===> 代理服务器 ===> 互联网
HTTP 流量工作正常,但 HTTPS 不能。
当我尝试访问https://google.com时,我在 Chrome 中看到一个错误:
This site can't provide a secure connection
当我将浏览器直接连接到代理服务器时 - HTTPS 工作正常
当我只连接到 VPN 服务器时 - HTTPS 工作正常。
如果我将 VPN 切换到 OpenVPN,也会出现同样的问题。
在嗅探流量后,我发现 HTTPS 请求正试图通过 HTTP 协议到达 HTTPS 地址。重定向似乎有一些问题,因为当我只是去 www.google.com 时,经过 2 次重定向(由 google 生成)后,我可以通过 https 访问 google,但是当我输入https://google.com -错误。
在 Wireshark 中出现 400 错误:
Expert Info (Warning/Security): Unencrypted HTTP protocol detected over encrypted port, could indicate a dangerous misconfiguration.
我的 IP 表规则:
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- ip-192-168-200-0.ec2.internal/24 anywhere tcp dpt:http to:172.31.64.145:9090
DNAT tcp -- ip-192-168-200-0.ec2.internal/24 anywhere tcp dpt:https to:172.31.64.145:9090
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- ip-192-168-200-0.ec2.internal/24 anywhere
MASQUERADE all -- ip-192-168-200-0.ec2.internal anywhere
其中 172.31.64.145:9090 - 代理服务器的 IP。
VPN 服务器和代理服务器在同一个 AWS 实例上运行。