我一直在尝试测试 Webrick 代理的链接,但遇到了一些麻烦。
每个代理都可以从 127.0.0.1:port 自行正常工作(当 :ProxyURI 为 proxy_2 注释掉时),但我收到错误消息:
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