代理使用 https 删除自定义标头

vda*_*bry 5 proxy https haproxy privoxy

问题 :

对于 HTTPS 请求,我的代理从响应中删除自定义标头:

HTTP请求:

$ curl -I -x 127.0.0.1:5566 http://www.google.fr
HTTP/1.1 200 OK
...
X-Servedby: 50001 => My custom header is added to the response
Run Code Online (Sandbox Code Playgroud)

完整回复:https : //gist.github.com/vdaubry/eafabf211957cbe87563

HTTPS 请求:

$ curl -I -x 127.0.0.1:5566 https://www.google.fr
HTTP/1.1 200 Connection established
Proxy-Agent: Privoxy/3.0.23
X-Servedby: 50001 => doesn't appear in the final response

HTTP/1.1 200 OK
Date: Sat, 07 Feb 2015 16:29:25 GMT
...
Vary: Accept-Encoding
Run Code Online (Sandbox Code Playgroud)

完整回复:https : //gist.github.com/vdaubry/2869d85b2e8affdc5a8c

我不明白为什么在连接打开时添加了自定义标头但不是最终响应?


更多信息:

我有对多个 Privoxy 实例的 HAProxy 负载平衡请求。HAProxy 正在将 privoxy 实例名称添加到自定义标头“X-Servedby”中的响应中(例如:如何获取已在前端部分提供请求的服务器的名称?

它适用于 HTPP 请求,但自定义标头与 HTTPS 请求一起被删除

Privoxy 设置为透明代理(accept-intercepted-requests=1)。在文档中它说

请注意,不支持拦截加密连接 (HTTPS)。

不确定这与问题有关吗?

Tom*_*ton 5

如果我没看错,那么您已经确定了问题所在。您真正的问题似乎是“使用 HTTPS 时未添加标头”- 对吗?代理负责插入头部?

如果是这种情况,则无法在不拦截 HTTPS 的情况下完成,因为所有栏之一的标头(主机)都已加密。