2014-04-29 80 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 

也許它在瀏覽器中緩存了一些東西?在導航到谷歌之前嘗試清除緩存?