Postman Proxy

Razvan Marescu edited this page May 1, 2014 · 3 revisions

The Postman Proxy server is a simple Twisted based Python script which allows you to send headers restricted by Chrome and the XMLHttpRequest specification. Due to these restrictions the following headers are blocked:

  • Accept-Charset
  • Accept-Encoding
  • Access-Control-Request-Headers
  • Access-Control-Request-Method
  • Connection
  • Content-Length
  • Cookie
  • Cookie 2
  • Content-Transfer-Encoding
  • Date
  • Expect
  • Host
  • Keep-Alive
  • Origin
  • Referer
  • TE
  • Trailer
  • Transfer-Encoding
  • Upgrade
  • User-Agent
  • Via

These restrictions probably make sense for protecting the user agent but make testing API backends difficult.

To use the work around:

  1. Go to Postman settings (top right corner) and enable the Postman Proxy option.
  2. Download this Python script - https://raw.github.com/a85/POSTMan-Chrome-Extension/master/proxy/proxy_server.py
  3. Make sure you have Twisted installed - http://twistedmatrix.com/trac/wiki/Downloads
  4. Run the proxy server using - python proxy_server.py. By default the server runs on 8000 and only works for HTTP protocols at the moment.
  5. Set localhost:8000 as the proxy inside your operating system. All HTTP calls in your OS will go through the OS so make sure you are only using it while you are testing your API.

Now you can send all the headers mentioned above. Postman does this by automatically prepending 'Postman-' to the restricted headers. The proxy strips out the 'Postman-' marker and sends the header forwards. Please remember that this is still under testing and things might change in the future.