Friday, 30 December 2016

How to configure Postman Native Client App to use an external proxy

TLDR; to configure Postman native client app to use a proxy start it with command line parameter --proxy-server=host:port

postman.exe --proxy-server=localhost:8888

One of things I like about Postman Chrome App is that, because it uses Chrome, it is really easy to feed through a debug proxy like Fiddler, or Zap, etc. etc.

But since Chrome Apps are going to die and Postman has a native app now, I thought I’d use that.

Uh oh! Where is the proxy setting?

There is a strange little satellite icon for “Proxy Settings” which lets me switch on an inbuilt proxy:

https://www.getpostman.com/docs/capture_native

That might be useful. I might want to send browser traffic to postman to build up a collection. I can’t imagine doing that, but it might be useful.

What about an external proxy?

But I could find no official documentation or support on how to configure an external proxy:

https://www.google.co.uk/search?q=postman+desktop+client+proxy

None.

I found that strange.

Does no-one else need this functionality?

Or perhaps everyone else knows how to configure it, and its really obvious, just not obvious to me.

And the answer is…

And the answer is that since Postman is an electron based application we can use the electron command line switches.

https://github.com/electron/electron/blob/master/docs/api/chrome-command-line-switches.md

Here’s how I do it on Windows.

I have a short cut with the target:

C:\Users\Alan\AppData\Local\Postman\app-4.9.3\Postman.exe --proxy-server=localhost:8888

OR I could go to the postman directory and run the command:

postman.exe --proxy-server=localhost:8888

Hope that helps.

11 comments:

  1. Hey Alan, thanks a bunch for this. You saved my day! Exactly what I was looking for. I had been using Postman as a Chrome app on Windows and Chrome depends on Windows internet connection settings for its proxy so it was a real pain to have to change those settings every time. But with this, I can just limit the proxy use to just Postman and change it any time I want. Awesome man! Thanks again. :-)

    ReplyDelete
    Replies
    1. You're welcome. Thanks for letting me know. Glad it helped :)

      Delete
  2. Thanks this really helped me, as you correctly said this wasn't corrected documented anywhere so great work finding this!

    ReplyDelete
  3. In my windows native postman installation I do not see any Postman.exe, looks like it uses Update.exe to start postman. How can I pass the command line parameter. Following is used to start Postman.
    C:\Users\username\AppData\Local\Postman\Update.exe --processStart "Postman.exe"
    If I try to pass the parameter postman does not start.
    C:\Users\username\AppData\Local\Postman\Update.exe --processStart "Postman.exe --proxy-server=localhost:8888"

    ReplyDelete
  4. In the properties dialog - where you found the command line - look at the target folder, that is where Postman.exe is installed.

    Or just look in your `C:\Users\username\AppData\Local\Postman` for the `app-x.x.x` directory

    Or in `C:\Users\username\AppData\Local\Postman` in explorer search for `Postman.exe`

    ReplyDelete
    Replies
    1. Now, I am getting authentication error as my proxy requires authentication. To set the proxy I used.

      postman.exe --proxy-server=myproxy:8090

      I get "Error: tunneling socket could not be establish, statusCode=407"

      I also tried following
      postman.exe --proxy-server=userName:password@myproxy:8090

      In this case it does not even set the proxy properly. Proxy gets set to "http://"
      I will appreciate any pointers.

      Delete
    2. I'd try having a local proxy setup and point postman through that. I'd start with a debug proxy like Fiddler or Charles. That way you can debug the traffic and there are better downstream proxy configuration options in those proxies.

      Delete
  5. Hey Alan, Thanks for sharing this.
    On Windows 10, trying to capture Postman traffic inside JMeter but not able to, even after running this command. Tried to capture through Fiddler and it worked.
    It turns out that Fiddler creates a proxy at system level as I can see the Proxy server checkbox ticked when Fiddler is running so it does not depend upon `Postman.exe --proxy-server=address:port`
    I verified it by running `Postman.exe --no-proxy-server`
    Still Fiddler is able to capture the traffic.
    So that puts a question mark on the effectiveness of above command.
    Struggling with this scenario, any help is greatly appreciated.

    Thanks in advance,
    Dinesh

    ReplyDelete
    Replies
    1. Hi,

      Yes, Fiddler should work at System Proxy level - as should Charles.

      I just upgraded to Postman 5.0.0 on Windows and Mac and this proxy setting still works for me as documented above.

      I have not tried JMeter Recording.

      To investigate I'd suggest ruling out any issue with JMeter Recording configuration first:

      - make sure JMeter recording is working by changing Firefox to point through JMeter and record traffic from Firefox

      Get a non-system hook proxy like BurpSuite or OWasp Zap running

      - point Firefox at this proxy and make sure you can see traffic

      Then check your Postman command

      - check the validity of your postman command by pointing it at a proxy that is not hooked in at a system level e.g. BurpSuite or Owasp Zap.

      Delete