How to set proxy when we run collection using command line

I am using Postman to test and Automate our API and we are facing proxy issues while running it via Command line.

To test our Api we are setting proxy in our Postman app, but when we run it through command line its failing since proxy is not passed.

Could you please let me know how we can set proxy when we run collection from command line using Newman.

Hi @ashutosh315ec,

Welcome to the postman community! :clap:

Since you are running your collections via the newman command line, the only way you can run it via the proxy is to set up the proxy at the system level (OS), as noted in the postman doc below.

https://learning.postman.com/docs/sending-requests/capturing-request-data/proxy/#using-system-proxy

Since I am not sure what OS you are running these collections on, I wouldn’t which way to exactly do it.

Here is a link on how to set up a proxy in Windows:

macOS:

Linux:
https://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/

Linux will vary depending on your OS, but the process should be relatively similar.

Hope this helps!
Orest

1 Like