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.85k stars 839 forks source link

Postman Windows App - Request to localhost in a proxied environment fails #2253

Closed jimonthebarn closed 7 years ago

jimonthebarn commented 8 years ago
  1. Postman Version: 4.5.1 win32 6.1.7601 / x64
  2. App (Chrome app or Mac app): Windows client
  3. OS details: Microsoft WIndows 7 Enterprise Version 6.1 (Build 7601: Service Pack 1)
  4. Is the Interceptor on and enabled in the app: nope
  5. Did you encounter this recently, or has this bug always been there: As far as I have tested it it has always been there.
  6. Expected behaviour: I expect postman to respect proxy settings (whereever they may be configured :) ). It seems that it is picking up the configured proxy of the operating system but it also routes the localhost traffic through the proxy which leads to the response below.
  7. Console logs (http://blog.getpostman.com/2014/01/27/enabling-chrome-developer-tools-inside-postman/ for the Chrome App, View->Toggle Dev Tools for the Mac app):

POST http://localhost:9000/someApi

Request Headers: Authorization:"Bearer " Content-Type:"application/json" cache-control:"no-cache" Postman-Token:"812e0b83-7cbf-439e-814a-bcbb6fe5ebea"

Response status: 403 Forbidden

Response Headers: Server:"squid/3.0.STABLE25" Mime-Version:"1.0" Date:"Thu, 11 Aug 2016 09:11:18 GMT" Content-Type:"text/html" Content-Length:"2315" X-Squid-Error:"ERR_ACCESS_DENIED 0" X-Cache:"MISS from proxy11.myDomain.net:3128" Via:"1.0 proxy11.myDomain.net:3128 (squid/3.0.STABLE25)" Proxy-Connection:"close"

jimonthebarn commented 8 years ago

Maybe this is somehow related to issue #2225

SamvelRaja commented 8 years ago

@jimonthebarn can you please confirm this fix in 4.6.1 ?

jimonthebarn commented 8 years ago

The problem still persists. Not only in the collection runner but in the "regular" request view as well.

This is a exemplary request (generated via HTTP code snippet): GET /pbs-simulator-tdb/bump HTTP/1.1 Host: localhost:9091 Content-Type: application/json Accept: application/json Cache-Control: no-cache Postman-Token: 48363268-d911-643e-fa6c-6557df398e22

Response status: 403 Forbidden

Response headers: Content-Length →1779 Content-Type →text/html Date →Wed, 17 Aug 2016 08:31:30 GMT Mime-Version →1.0 Proxy-Connection →close Server →squid/3.0.STABLE25 Via →1.0 proxy11.somedomain.net:3128 (squid/3.0.STABLE25) X-Cache →MISS from proxy11.somedomain.net:3128 X-Squid-Error →ERR_ACCESS_DENIED 0

Response body: `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

ERROR: The requested URL could not be retrieved

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: http://localhost:9091/pbs-simulator-tdb/bump

Access Denied.

Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.

Your cache administrator is Generated Wed, 17 Aug 2016 08:31:30 GMT by proxy11.somedomain.net:3128 (squid/3.0.STABLE25)

`
jimonthebarn commented 8 years ago

The postman console has some additional request headers: User-Agent:"PostmanRuntime/2.4.1" accept-encoding:"gzip, deflate"

jimonthebarn commented 8 years ago

It might be worth mentioning that in our particular environment at work the proxy settings are managed using a auto configuration url. Maybe postman does not take settings configured that way into account.

dylantf commented 8 years ago

Just found this issue after having the same problem on my own computer. Can't send any requests to localhost using the desktop app on Windows 10. Works fine using the Chrome app and the desktop version on macOS.

SamvelRaja commented 8 years ago

@dyyylan @jimonthebarn can you make sure that postman is picking up your proxy by checking in the Postman Console (View -> Show Postman Console) in 4.6.2 version of the app.

screenshot 4

dylantf commented 8 years ago

I should have clarified I'm not even using a proxy at all, anything to localhost fails on the desktop app, I just get ECONNREFUSED. Hitting 127.0.0.1 instead seems to work ok. Maybe this is a separate issue since I'm not running a proxy.

jimonthebarn commented 8 years ago

Here is the output of the aforementioned call: postmanproxytest

I have garbled the ip address of the proxy but it is the correct one though.

czardoz commented 8 years ago

@jimonthebarn It seems that you did get the expected 200 OK response from echo.getpostman.com, and the request was made through the proxy. Can you show us an example of the 403 ACCESS DENIED error you mentioned earlier?

jimonthebarn commented 8 years ago

Sure thing: postmanproxytest2

MiguelTVMS commented 8 years ago

Got the same problem:

Url: http://localhost:39216/api/checkout/XXXXXXXXXX
Request Headers:
   cache-control:"no-cache"
   Postman-Token:"89944570-3ccd-4a7a-94c1-d01e5f396ba6"
   Content-Type:"application/json"
   User-Agent:"PostmanRuntime/2.4.2"
   Accept:"*/*"
   Host:"localhost:39216"
   accept-encoding:"gzip, deflate"
   content-length:84

Response Headers:
   Server:"squid/3.3.8"
   Mime-Version:"1.0"
   Date:"Thu, 25 Aug 2016 15:51:05 GMT"
   Content-Type:"text/html"
   Content-Length:"3509"
   X-Squid-Error:"ERR_CONNECT_FAIL 111"
   X-Cache:"MISS from proxy01"
   X-Cache-Lookup:"MISS from proxy01:3128"
   Via:"1.1 proxy01 (squid/3.3.8)"
   Connection:"keep-alive"
vivaladan commented 8 years ago

I have the same problem. I'm using a configuration proxy script as per my corporate network.

For external requests postman native app sets the proxy. For localhost it doesn't set the proxy, but the request does leave the machine. I know it leaves because the response is a 504 and includes a VIA header with an internal network machine. The response is below for what it's worth, however I think the problem is just that postman is sending the request out of the machine and not dealing with it locally.

GET
http://localhost:34804/api/something/something/darkside
04:40:40.391
Request Headers:
cache-control:"no-cache"
User-Agent:"PostmanRuntime/2.4.5"
Accept:"*/*"
Host:"localhost:34804"
accept-encoding:"gzip, deflate"
Response Headers:
Date:"Thu, 08 Sep 2016 15:40:36 GMT"
Connection:"close"
Via:"1.1 <HIDDEN>"
Cache-Control:"no-store"
Content-Type:"text/html"
Content-Language:"en"
Content-Length:"666"
Response Body:
<HEAD><TITLE>Unknown Host</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Unknown Host</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Unable to locate the server named "<em>localhost</em>" --- the server does not have a DNS entry.  Perhaps there is a misspelling in the server name, or the server no longer exists.  Double-check the name and try again.</B></FONT>
<HR>
<!-- default "Unknown Host" response (504) -->
</BODY>
roeschjohannes commented 8 years ago

As workaround you could set a system environment variable named NO_PROXY with the value localhost. Than it works as expected. As bugfix for the requests with localhost as destination, the proxy configuration should be overwritten.

jimonthebarn commented 8 years ago

@roeschjohannes: You my friend are awesome. I didnt think of manually overwriting the no_proxy setting. Thanks a bunch. :)

Johannes Roesch notifications@github.com schrieb am Fr., 23. Sep. 2016 um 10:42 Uhr:

As workaround you could set a system environment variable named NO_PROXY with the value localhost. Than it works as expected. As bugfix for the requests with localhost, the proxy configuration should be overwritten.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/postmanlabs/postman-app-support/issues/2253#issuecomment-249136082, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkjmLYFvwc5ccLFKzR6p8wHbc7e1mULks5qs5D1gaJpZM4Jh8a4 .

ysrc26 commented 7 years ago

You need to set proxy environments within the cmd and run postman from cmd. This is work for me, open cmd and set the following:

set HTTP_PROXY=http://your_proxy_host:your_port
set HTTPS_PROXY=https://your_proxy_host:your_port

And then run the postman by:

(this command is to run postman in background)

%AppData%\..\Local\Postman\Update.exe --processStart "Postman.exe"

If your proxy requires authentication, you need to use this:

set http_proxy=http://username:password@your_proxy_host:your_port
set https_proxy=https://username:password@your_proxy_host:your_port
ghost commented 7 years ago

Just for the sake of completeness. You can also supply the required settings to the postman executable directly: %APPDATALOCAL%\Postman\app-5.0.2\Postman.exe --proxy-server=http://localhost:8080 --proxy-bypass-list=localhost

harryi3t commented 7 years ago

In the latest version of Postman 5.2.0, we have added additional settings to manage proxy settings image

Just turn off the proxy and it should work. Let me know if you still face the issue.

LordGG commented 7 years ago

The new setting didn't solve the issue to me. But no problem with the Chrome app.

harryi3t commented 7 years ago

@LordGG can you explain the issue little bit more. A screenshot of the request log in the console might help. Also here's the link for the documentation related to the proxy https://go.pstmn.io/proxy-doc

If you wish we can join on a slack chat to debug and solve the issue? Here's the link to join the Postman Community Channel https://www.getpostman.com/slack-invite

LordGG commented 7 years ago

@harryi3t , Yes sorry. I am meeting the same kind of issue as above. I am running on Windows 7 and a system proxy is declared. When I try to call a resource on localhost, it fails. "Use System Proxy" setting has no effect.

When I use the Chrome Application, it works perfectly.

Here is the log : GET http://localhost:54674/api/Values/ReadData2?Id=1&Name=test 10:22:51.407 Request Headers: cache-control:"no-cache" postman-token:"b1e8f7fc-2b40-4e65-8e8f-9696725688c4" user-agent:"PostmanRuntime/6.3.2" accept:"/" host:"localhost:54674" accept-encoding:"gzip, deflate" proxy-authorization:"Basic amVyb21lLmxlZmV2cmU6TG9jYXJjaGl2ZXMyOQ==" Response Headers: server:"squid/3.1.19" mime-version:"1.0" date:"Fri, 01 Sep 2017 08:22:52 GMT" content-type:"text/html" content-length:"3520" x-squid-error:"ERR_CONNECT_FAIL 111" vary:"Accept-Language" content-language:"en" x-cache:"MISS from localhost" x-cache-lookup:"MISS from localhost:3127" connection:"keep-alive" proxy-connection:"keep-alive" Response Body:

And I can see a page with :

ERROR The requested URL could not be retrieved The following error was encountered while trying to retrieve the URL: http://localhost:54674/api/Values/ReadData2? Connection to ::1 failed. The system returned: (111) Connection refused The remote host or network may be down. Please try the request again. Your cache administrator is webmaster. Generated Fri, 01 Sep 2017 08:27:32 GMT by localhost (squid/3.1.19)

harryi3t commented 7 years ago

@LordGG I can see that while making the request to localhost it's using the proxy.

Try turning off both system proxy and global proxy so that while making the request Postman would not use any proxy

If that works then you need to set exception for localhost in your proxy configuration In windows 7 this can be done using checking the Bypass proxy server for local addresses check box windows-proxy

If that doesn't work, I am happy to assist over our slack postmancommunity channel.

LordGG commented 7 years ago

Thanks @harryi3t for your reply. Exception is already set for localhost. I have also tried to disable it but it doesn't work either.

I'm not on Slack, but don't worry, I have switched to the Chrome App and it does the job perfectly :)

harryi3t commented 7 years ago

@LordGG I am happy that Chrome app works for you. I just want to mention that Google has announced plans to end support for Chrome apps for every platform. Soon the chrome app would become deprecated. Already there are some features which are available exclusively on native apps and we recommend to use the native apps.

I am still open to helping you (or anyone facing this issue) out :) If anyone can help me reproduce this issue, I would really appreciate it.

harryi3t commented 7 years ago

@LordGG I just noticed this in your error log

Connection to ::1 failed.

Maybe you have a mapping localhost to ipv6 (::1) and your local server does not support ipv6

Can you try replacing localhost to 127.0.0.1 and then send the request

http://127.0.0.1:54674/api/Values/ReadData2
LordGG commented 7 years ago

@harryi3t , I had already tried with 127.0.0.1 with no more success.

I have followed your reference to #3084 , and what worked for me was unsetting HTTP_PROXY and HTTPS_PROXY global vars. So now I have a .bat file with :

set HTTP_PROXY=
set HTTPS_PROXY=
C:\Users\my_account\AppData\Local\Postman\Update.exe --processStart "Postman.exe"

I had set those variables to have cUrl working with our proxy server. I can't tell why disabling both proxy options in Postman is not sufficient, but I can confirm that unsetting those 2 variables in addition to Postman's proxy settings fixes the prbl :)

Thanks :)

Bragolgirith commented 7 years ago

Should this issue really be closed? That is a nice workaround, but the underlying issue - Postman ignoring the proxy settings - hasn't been fixed.

moskal91 commented 7 years ago

Same issue for me in Postman 5.3.2! How it could be closed just like that without fix? Postman is still using system proxy even if it is disabled in options (HTTP_PROXY and HTTPS_PROXY environment variables are still respected). Only elegant way to fix this issue under Windows is setting NO_PROXY envronment variable to localhost,127.0.0.1 (turning on "Don't use the proxy server for local (intranet) addresses" in Windows 10 proxy settings does not work in Postman too).

jaxspades commented 7 years ago

Even with all proxy settings in Postman turned off and the NO_PROXY environment variable set to localhost,127.0.0.1, I still have to use a local proxy like Fiddler just to get it to route appropriately on my machine, otherwise I get the generic "No response" message.

abenhaim commented 6 years ago

Same issue as @moskal91. Access to a local network IP, with proxy config file (.pac) defined Postman chrome : works perfectly Postman Windows 10 :

ronrother commented 6 years ago

Same issue with the Linux application. Mixing @LordGG and @abenhaim solutions worked for me. I am starting Postman with the following command:

HTTP_PROXY= HTTPS_PROXY= NO_PROXY=localhost postman

nemoo commented 6 years ago

Using Postman for Windows Version 6.0.10 the issue is also still not fixed. Even when I disable the proxy in the Postman > Proxy settings, Postman still uses the proxy. Please reopen this issue.

harryi3t commented 6 years ago

@nemoo You must be having some environment variables set (http_proxy, etc) Please unset them (using a script) before opening postman. Check @LordGG's comment https://github.com/postmanlabs/postman-app-support/issues/2253#issuecomment-326564966

nemoo commented 6 years ago

@harryi3t Currently the Postman GUI suggests that the proxy can be deactivated in the GUI. That is apparently not the case.

If this workaround is meant to stay would it be possible to add the information about the workaround to the Postman Proxy GUI tab so that users will know about it? As it is now they first have to find this issue on Github to find out how to operate Postman.

zdrouse commented 6 years ago

I'm experiencing this issue on Postman Native still, when I open Postman the "Use System Proxy" setting is turned off yet the calls are still using the system proxy settings.

hungndiam commented 5 years ago

For me in window 10, I just need to check on "Don't use the proxy server for local (intranet) addresses" image

mikenap commented 5 years ago

Working with a colleague of mine, nothing above worked, however, using the IP address of the machine worked (instead of using localhost or 127.0.0.1) when making the request.