Debugging APIs consumed by your app

Imagine your Heroku app consumes some API like this (in Ruby):

Net::HTTP.get('', '/index.json')

You can debug the traffic between your app and the API provider by putting a reverse proxy in front of it:

$ heroku plugins:install dockhero
$ heroku addons:create dockhero  # installation will take some time

$ heroku dh:docker run -d -p 80:8080 -p 8081:8081 johnmccabe/mitmweb \

This launches mitmweb reverse proxy which forwards all incoming traffic to

The proxy's address is exposed via DOCKHERO_HOST environment variable, so your app's code needs to be updated to make requests to the proxy:

Net::HTTP.get(ENV['DOCKHERO_HOST'], '/index.json')

Now you can review and even replay the requests by visiting the web UI in your browser:

$ heroku dh:open 8081


results matching ""

    No results matching ""