2014-04-29 82 views
0

我想在本地主机上的端口8080上运行Verticle,以便当我将Firefox配置为使用http://localhost:8080作为代理时,它将连接到Verticle,我应该能够获取URL这是要求。为Firefox配置Vert.x代理

换句话说,无论我在地址栏中输入什么URL(比如www.google.com),都应在Verticle中提供。我的最终目标是在URL处获取html,注入我自己的一些脚本并将其提供给用户。

目前,当我在8080上运行服务器时,Firefox简单地回应说服务器没有响应。

此外,我无法println任何东西,当我键入一个URL(如google.com),似乎表明一个连接从未作出。相反,当我输入localhost:8080时,我得到了正确的响应以及absoluteURL。

+0

你有没有在Perferences-> Network-> Connection Settings中设置你的Firefox代理地址? –

+0

是的,我已将其设置为部署代理的localhost 8080。 – Ranjit

+0

我想你的代码是不正确的然后... –

回答

0

奇..如果你运行在vertx-实例库代理例如:

https://github.com/vert-x/vertx-examples/blob/master/src/raw/groovy/proxy/Server.groovy

启动端口8282代理。如果随后进入Firefox的偏好:

首选项 - >网络 - >连接设置

,并设置HTTP Proxylocalhostport8282并勾选Use this proxy server for all protocols

然后在地址栏中输入google.com应该在终端窗口中显示日志记录,并且浏览器应显示:

server-data-chunk-0server-data-chunk-1server-data-chunk-2server-data-chunk-3ser‌​ver-data-chunk-4server-data-chunk-5server-data-chunk-6server-data-chunk-7server-d‌​ata-chunk-8server-data-chunk-9 

也许它在浏览器中缓存了一些东西?在导航到谷歌之前尝试清除缓存?