a netty-based http proxy
Scala
Switch branches/tags
Nothing to show
Pull request Compare This branch is 7 commits behind stephenh:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
src/main
.classpath
.gitignore
.project
README.markdown
build.xml
ivy.xml
ivybootstrap.xml
ivysettings.xml

README.markdown

Intro

fakehttp is an HTTP proxy written in Scala on top of Netty.

fakehttp's original use case was intercepting automated browser testing traffic, however it can also function as a general purpose HTTP proxy.

Intercepting Browser Traffic

While shuffling bytes between the incoming browser and the outgoing server, fakehttp provides an Interceptor hook to inspect requests and either modify the destination or respond directly.

E.g. for automated testing, the LocalhostInterceptor can route browser traffic that would otherwise go to http://www.somesite.com to http://localhost. This is useful for containing (and asserting against) URLs within your application you either cannot easily change or are using to test cross-domain functionality.

Usage

Run Proxy as the main class, passing in the port as the only argument. Or with the jar:

java -jar fakehttp.jar 8081

The fakehttp jar includes its own dependencies (netty and the Scala runtime library) to make copying/installing it easier.

To change things other than the port (e.g. interceptor or ssl mode), currently you just have to edit the Proxy class.

Note that you'll also have to configure your browser to use the proxy on the host/port you started fakehttp on.

SSL Modes

fakehttp has two SSL modes:

  • OpaqueSslMode leaves SSL traffic as encrypted and means you can no longer inspect the HTTP contents going back and forth
  • ClearSslMode sets fakehttp up as a man-in-the-middle to decrypt and re-crypt the SSL traffic you can continue inspecting it

License

fakehttp is Apache licensed, except for the CyberVillain stuff that drives ClearSslMode, which is ASL licensed to Selenium and I include here mostly as a proof of concept/cool hack.