Proxy 使用polipo将shadowsocks转换为HTTP代理

Proxy 使用polipo将shadowsocks转换为HTTP代理,proxy,http-proxy,socks,polipo,Proxy,Http Proxy,Socks,Polipo,我的ssserver由docker映像启动: 然后我使用sslocal命令获取本地代理 sslocal -c /etc/shadowsocks.json -d start --pid-file /data/tmp/sslocal.pid --log-file /data/tmp/sslocal.log /etc/shadowsocks.json如下: { "server":"127.0.0.1", "server_port":1984, "local_address": "127.

我的ssserver由docker映像启动:

然后我使用
sslocal
命令获取本地代理

sslocal -c /etc/shadowsocks.json -d start --pid-file /data/tmp/sslocal.pid --log-file /data/tmp/sslocal.log
/etc/shadowsocks.json
如下:

{
  "server":"127.0.0.1",
  "server_port":1984,
  "local_address": "127.0.0.1",
  "local_port":1080,
  "password":"paaassswwword",
  "timeout":600,
  "method":"aes-256-cfb"
}
* Rebuilt URL to: google.com/
*   Trying host...
* Connected to host (host) port 8123 (#0)
> GET HTTP://google.com/ HTTP/1.1
> Host: google.com
> User-Agent: curl/7.43.0
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 302 Found
< Content-Length: 262
< Date: Thu, 13 Apr 2017 09:52:34 GMT
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< Referrer-Policy: no-referrer
< Location: http://www.google.com.sg/?gfe_rd=cr&ei=YkrvWPnOM-XLugTRgZDQBA
< Connection: keep-alive
< 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.sg/?gfe_rd=cr&amp;ei=YkrvWPnOM-XLugTRgZDQBA">here</A>.
</BODY></HTML>
* Connection #0 to host host left intact
我使用
polipo
将shadowsocks转换为http代理,我的
/etc/polipo/config
是:

proxyAddress = 0.0.0.0
socksProxyType = socks5
socksParentProxy = 127.0.0.1:1080
daemonise = true
pidFile = /data/tmp/polipo.pid
logFile = /data/tmp/polipo.log
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:1080          0.0.0.0:*               LISTEN      5067/python     
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      9704/polipo     
tcp6       0      0 :::8388                 :::*                    LISTEN      4238/docker-proxy
我编辑iptables规则,使端口8123可以访问。我可以访问
http://host:8123
在浏览器中,代理看起来工作正常:

http_proxy=http://host:8123 curl -v google.com 
输出如下:

{
  "server":"127.0.0.1",
  "server_port":1984,
  "local_address": "127.0.0.1",
  "local_port":1080,
  "password":"paaassswwword",
  "timeout":600,
  "method":"aes-256-cfb"
}
* Rebuilt URL to: google.com/
*   Trying host...
* Connected to host (host) port 8123 (#0)
> GET HTTP://google.com/ HTTP/1.1
> Host: google.com
> User-Agent: curl/7.43.0
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 302 Found
< Content-Length: 262
< Date: Thu, 13 Apr 2017 09:52:34 GMT
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< Referrer-Policy: no-referrer
< Location: http://www.google.com.sg/?gfe_rd=cr&ei=YkrvWPnOM-XLugTRgZDQBA
< Connection: keep-alive
< 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.sg/?gfe_rd=cr&amp;ei=YkrvWPnOM-XLugTRgZDQBA">here</A>.
</BODY></HTML>
* Connection #0 to host host left intact
netstat-tlnp的输出是:

proxyAddress = 0.0.0.0
socksProxyType = socks5
socksParentProxy = 127.0.0.1:1080
daemonise = true
pidFile = /data/tmp/polipo.pid
logFile = /data/tmp/polipo.log
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:1080          0.0.0.0:*               LISTEN      5067/python     
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      9704/polipo     
tcp6       0      0 :::8388                 :::*                    LISTEN      4238/docker-proxy

我真的找不到原因,谢谢你的帮助。

谷歌使用https,而不是http,试试看

https_proxy=http://host:8123 curl -v https://www.google.com 

谷歌使用https,而不是http,试试看

https_proxy=http://host:8123 curl -v https://www.google.com