Question

I would like to run a verticle at port 8080 on the localhost so that when I configure Firefox to use http://localhost:8080 as proxy, it will connect to the verticle and I should be able to get the URL that was requested.

In other words, whatever URL I type in my address bar(say www.google.com), that should be available in the verticle. My ultimate aim is to get the html at the URL, inject some script of my own and serve it up to the user.

Currently when I run a server at 8080 Firefox simply responds that Server didn't respond.

Also I am unable to println anything when I type a URL(like google.com) which seems to suggest a connection was never made. Instead when I type localhost:8080 I get a proper response as well as the absoluteURL.

Was it helpful?

Solution

Odd.. If you run the proxy example in the vertx-examples repository:

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

That starts the proxy on port 8282. If you then go into the Firefox preferences:

Preferences -> Network -> Connection Settings

And set the HTTP Proxy to localhost, the port to 8282 and check the checkbox Use this proxy server for all protocols

Then typing google.com into the address bar should show logging in the terminal window, and the browser should display:

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

Maybe it's cached something in the browser? Try clearing the caches before navigating to google?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top