postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.87k stars 841 forks source link

Set proxy for a single request in postman #9060

Open zhangbin90 opened 4 years ago

DannyDainton commented 4 years ago

Hey @zhangbin90

A proxy will be applied to all requests and cannot be used against just a single request.

Postman to direct all requests made in the Postman app to route through a proxy server. 

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

hari-hlubovac-carvana commented 3 years ago

@DannyDainton, could this be filed as a feature request (to make its way to "Settings" tab that's within each request definition)?

dimalyshev commented 2 years ago

The feature is on great demand, but there is a bypass to add bypass hosts in Proxy settings tab

gaberogan commented 2 years ago

@DannyDainton Can we reopen this? Or is this a "won't fix"? My use case is dealing with old data providers whose security consists of a domain whitelist, so any requests in Postman must be proxied through specific servers.

gaberogan commented 2 years ago

It seems like the Request definition contains a proxy setting, maybe that can be updated in the pre-request script. If anyone can confirm that'd be great http://www.postmanlabs.com/postman-collection/Request.html#~definition

ppLorins commented 1 year ago

I think we can use tool like privoxy to utilize at hand socks5 proxy, it will working as a bridge between postman http/https and your socks5. Most importantly, supporting customized proxied domains.

fappaz commented 1 year ago

I too need to set a proxy for a single request in my collection.

The pre-request script for my request looks like this:

// From http://www.postmanlabs.com/postman-collection/Request.html#~definition
const ProxyConfig = require('postman-collection').ProxyConfig;

pm.request.proxy = new ProxyConfig({
    host: `my.proxy.com`,
    match: 'http+https://*\/*',
    port: 9999,
    tunnel: true,
    disabled: false,
    authenticate: true,
    username: 'myUsername',
    password: 'myPassword',
});

However, the request simply times out (Error: connect ETIMEDOUT), where as a curl command works as expected:

curl --location --request GET "https://some.rest.api/" --proxy https://myUsername:myPassword@my.proxy.com:9999"

Has anybody had any progress with this?

fappaz commented 1 year ago

@DannyDainton Please see my previous post where I'm assigning a ProxyConfig to the pm.request.proxy but nothing seems to happen (i.e. the request is not going through the proxy). Is that the expected behavior?

Would appreciate it if you could reopen the issue as either a bug report (because the proxy is not working as expected), a feature request (because it's a useful feature that people have been asking for) or a feedback (because the proxy is useless? / requires better documentation?).

DannyDainton commented 1 year ago

Reopening this based on the additional messages after the issue was closed.

taotao365s commented 2 months ago

I need this function too,how is it going?