我一直在尝试测试Webrick代理的链接,但我遇到了一些问题。
从127.0.0.1:port开始,每个代理都可以很好地工作(当proxy_2的:ProxyURI被注释掉时),但我得到了错误:
ERROR unsupported method `GET'. 当我尝试链接它们时,从proxy_2输出(httpproxy.rb)。
为了澄清,当我链接它们时,我使用127.0.0.1:8086作为来自另一个应用程序的访问点。
查看proxy_1的日志,它似乎没有收到任何请求。
任何帮助都将不胜感激。
require 'webrick'
require 'webrick/httpproxy'
port_1 = 8085
port_2 = 8086
proxy_1 =
WEBrick::HTTPProxyServer.new(
:Port => port_1,
:ServerType => Thread,
:Logger => WEBrick::Log.new("./logs/#{port_1}.out"),
:ServerName => "future_authentication_proxy"
)
proxy_1.start
proxy_2 =
WEBrick::HTTPProxyServer.new(
:Port => port_2,
:ProxyURI => '127.0.0.1:'+port_1.to_s
)
trap("INT"){
proxy_1.shutdown
proxy_2.shutdown
}
proxy_2.start发布于 2012-12-06 00:51:51
您传递了错误的ProxyURI选项,应该是这样的:
:ProxyURI => URI.parse("http://#{host_1_ip}:#{port_1}/")https://stackoverflow.com/questions/13711120
复制相似问题