# How to set proxy when we run collection using command line

**URL:** <https://community.postman.com/t/how-to-set-proxy-when-we-run-collection-using-command-line/14242>\
**Category:** Help Hub\
**Tags:** newman-project, tests, collections\
**Created:** [July 17, 2020, 10:10am UTC](https://community.postman.com/t/how-to-set-proxy-when-we-run-collection-using-command-line/14242 "2020-07-17T10:10:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashutosh315ec](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@ashutosh315ec](https://community.postman.com/u/ashutosh315ec)\
**Post date:** [July 17, 2020, 10:10am UTC](https://community.postman.com/t/how-to-set-proxy-when-we-run-collection-using-command-line/14242/1 "2020-07-17T10:10:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![odanylewycz](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/odanylewycz/32/3240_2.png) [@odanylewycz](https://community.postman.com/u/odanylewycz)\
**Post date:** [July 17, 2020, 2:23pm UTC](https://community.postman.com/t/how-to-set-proxy-when-we-run-collection-using-command-line/14242/2 "2020-07-17T14:23:05Z")

</div>

Hi @ashutosh315ec,

Welcome to the postman community! 👏

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](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:  
[https://www.howtogeek.com/tips/how-to-set-your-proxy-settings-in-windows-8.1/](https://www.howtogeek.com/tips/how-to-set-your-proxy-settings-in-windows-8.1/)

macOS:

> **[How to Configure a Proxy Server on a Mac](https://www.howtogeek.com/293444/how-to-configure-a-proxy-server-on-a-mac/)**
>
> When you configure a proxy server on your Mac, applications will send their network traffic through the proxy server before going to their destination.

Linux:  
[https://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/](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

---

<div class="post-metadata">

**Author:** ![kite0](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@kite0](https://community.postman.com/u/kite0)\
**Post date:** [June 25, 2021, 2:19pm UTC](https://community.postman.com/t/how-to-set-proxy-when-we-run-collection-using-command-line/14242/3 "2021-06-25T14:19:34Z")

</div>

I read at github Forum that people use in command line: HTTP\_PROXY=‘[http://login:password@proxy:80/](http://login:password@proxy:80/)’ newman run postman\_collection.json

but it doesn’t work for me. the response is HTTP\_PROXY is a wrong command

my idea now was to set HTTP\_PROXY as env variable. then i export the file and added the command “-e myenv.json” with key: HTTP\_PROXY and value [http://login:password@proxy:80/](http://login:password@proxy:80/)

but still timeout because of proxy issue

---

<div class="post-metadata">

**Author:** ![Abarran](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Abarran](https://community.postman.com/u/Abarran)\
**Post date:** [September 7, 2021, 9:06pm UTC](https://community.postman.com/t/how-to-set-proxy-when-we-run-collection-using-command-line/14242/4 "2021-09-07T21:06:41Z")

</div>

Hello eveyone

I need to put two proxies in the newman run CLI. I have a request that needs the proxy and another request that is localhost that doesn’t need it. I need the proxy not to apply for the localhost

set HTTP\_PROXY=[example.com](http://example.com) NO\_PROXY=localhost && newman run collection.json
