67

I am in a corporate env so I have to use a proxy to reach servers. This works well in postman and in browsers. What I can't reach is localhost in postman but I can reach localhost in the browser.

I am running Postman for Linux Version 6.0.9. I have tried reaching localhost:9082/rest/myapi.... and 127.0.0.1:9082/rest/myapi with both global proxy and system proxy turned on and with either turned on and with non turned on. In all cases I am not able to reach localhost.

What I get as an response is an error page from the proxy server! Someway the call gets out on the network instead of being kept on my machine.

The postman console:

My request headers are:

Cache-Control →no-cache
Connection →Keep-Alive
Content-Length →986
Content-Type →text/html; charset=utf-8
Pragma →no-cache
Proxy-Connection →Keep-Alive

My response headers are:

cache-control:"no-cache"
pragma:"no-cache"
content-type:"text/html; charset=utf-8"
proxy-connection:"Keep-Alive"
connection:"Keep-Alive"
content-length:"986"

My response body is an html page.

How can I make a call to localhost work with postman?

Ulrich Eckhardt
  • 16,572
  • 3
  • 28
  • 55
user1329339
  • 1,295
  • 1
  • 11
  • 26
  • It seems this has been solved in v.7.0.9. For versions before that, [Nayak's answer](https://stackoverflow.com/a/54288710/5122657) below worked for me. – Leonard AB May 10 '19 at 07:40
  • Postman 7.2.1 was working then started getting a 'Could not get any response' error connecting to localhost. Turned off 'Use System Proxy' in settings, and it started working again. We're not using a proxy as far as I know. – Kevin Hooke Jun 21 '19 at 18:16

22 Answers22

163

I was having similar issue with HTTP calls to local ASP.NET Core Web API apps. Changing the proxy settings didn't fix it for me.

Finally fixed it by turning off File > Settings > General > SSL Certificate Verification

starball
  • 20,030
  • 7
  • 43
  • 238
Tonmoy
  • 2,008
  • 2
  • 10
  • 16
  • 1
    Postman will take the proxy settings from some environment variables (http_proxy, HTTPS_PROXY, etc) even if they are turned off from the UI – Rohit Gupta Feb 19 '19 at 11:58
  • This will work, but [Peter Matisko's answer below](https://stackoverflow.com/a/52853979/336648) is probably both simpler and better, even if it has racked up significantly fewer votes so far; it avoids messing with / disabling SSL verification. – Kjartan Jun 19 '20 at 07:06
44

I have the same issue. What works for me is:

Open File -> Settings -> Proxy

Then, enable proxy and put 127.0.0.1 : 80, if your web server runs on 80.

In the git thread, they say it is a known issue, so hopefully it will get resolved soon.

Peter Matisko
  • 2,113
  • 1
  • 24
  • 47
  • 1
    This solution seems by far to be the easiest way around this problem. No need to mess with environment variables, no need to open possible security holes. – Eric Antoine Scuccimarra Aug 23 '19 at 06:24
  • Worked for me, but I wish I understood why. I noticed when I `ping localhost`, I get the IPv6 address `::1` not the IPv4 address `127.0.0.1`. Possibly related? – TBirkulosis Aug 28 '19 at 15:57
  • @TBirkulosis I am not sure, if the behaviour without the proxy isn't actually a bug. Postman probably reaches to a wrong place. I haven't found a proper answer either. – Peter Matisko Aug 28 '19 at 16:21
20

I solved this by Turning off System proxy of Postman.

Open File -> Settings -> Proxy

Postman

Then Turn off Use System Proxy

Menuka Ishan
  • 5,164
  • 3
  • 50
  • 66
  • 1
    How frustrating when I've tried every other answer up to this point before finding the one that works. It seems there's any number of ways for it not to work with very little indication of what the problem is. – DaveDev Jul 13 '20 at 04:10
  • @DaveDev closest thing I can give for you that it should be something with corporate proxies. You might need some networking wisdom too to find this out. But my friend I have backlogs to finish before I sleep :) – Menuka Ishan Jul 30 '20 at 18:02
12

@Menuka Ishan Answer is correct. But in mac only if we change the turn off proxy won't work. You need to turn off the SSL Certificate verification also you need to disable.

Open Setting -> General -> SSL Certificate verification -> OFF

Aravindhan R
  • 270
  • 5
  • 26
  • Please do not switch off SSL verification. This could be potentially a huge security risk. – Dharman Aug 17 '19 at 16:01
  • 1
    @Dharman. But if i didn't turn off SSL verification post man is not working. There is any other way? – Aravindhan R Aug 17 '19 at 17:47
  • The .NET Core Web API tutorial walks you thru turning off this option also: See => https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio#install-postman It is helpful for localhost development – raddevus May 19 '20 at 18:00
11

I found a temporary solution:

In terminal, go to the directory where postman is installed and add:

machine@dev:~/Documents/Postman$ export NO_PROXY=localhost,127.0.0.1
machine@dev:~/Documents/Postman$ ./Postman 

This will make calls to localhost work.

I found a similar problem on Windows machines here

user1329339
  • 1,295
  • 1
  • 11
  • 26
7

The problem mentioned as an issue here. You should just write a simple batch file like this:

set HTTP_PROXY=
set http_proxy=
set HTTPS_PROXY=
set https_proxy=
START %LOCALAPPDATA%\Postman\Update.exe --processStart "Postman.exe"

open a simple text file, save this as a ".bat" file, and just run it!

snoba
  • 153
  • 3
  • 8
4

I also faced the same issue, but the trick was I implemented both the methods that were stated earlier in the stack. First I turned off the postman proxy as shown in below image.

Click Settings -> Proxy

enter image description here

And then turned off the SSL certificate verification check button.

Click Settings -> General

enter image description here

And then tried to hit my local server and finally it worked.

Shaikh Nazish
  • 169
  • 1
  • 4
3

While attempting to Get https://localhost:5001/WeatherForecast via PostMan while developing a basic .NET Core (3.1) Web API (on Ubuntu Linux) I got the error:

Could not get any response There was an error connecting to https://localhost:5001/WeatherForecast.

I didn't notice the actual solution in the things to try at first, but if you check the highlighted text in the image you will see it.

postman error

You can see that the option is turned on in PostMan by default:

PostMan Settings

I turned the SSL Certificate Verification off and tried again and it worked.

raddevus
  • 8,142
  • 7
  • 66
  • 87
2

If you are under corporate proxy and you are deploying your webapplication in localhost then no need to set proxy configuration like

http://username:password@corporateProxyServer:ServerPort in postman (Global Proxy Configuration).

As the app is deployed in local machine just use the localhost configuration in setting -> Global Proxy Configuration as :

 proxy server : 127.0.0.1
 port : 8300 (this is the port where the web application is running )
1

My problem was that i was setting an invalid Header token and it gave me the error

Error: Header name must be a valid HTTP token ["Accept "] Warning: This request did not get sent completely and might not have all the required system headers

Just check your Headers.

peter1
  • 11
  • 1
1

Adding another potential answer to this for people to check after they've tried the other ideas here.

I was able to solve my own problem by checking the Postman console (View -> Show Postman Console) and then examining the error from the request (in my case it was because I had a newline character on an auth token).

Zulukas
  • 1,180
  • 1
  • 15
  • 35
1

In my case, I had to precede the localhost with https://

Ali Bdeir
  • 4,151
  • 10
  • 57
  • 117
0

These steps solved this issue after 1 whole day struggle: 1) HTTP_PROXY= proxy.company.com:port HTTPS_PROXY=proxy.company.com:port to user variables, not to System variables. Make sure the the case is all cap. 2) Updating newtwork driver, and turning on Windows Defender......Make sure you don't see no reds in here.

0

I was not able to make any calls from postman to docker container running Couchbase Server. Very frustrating. Turns out I had proxy setting configured to some aws instance which has been long deleted.

Goto setting and remove the proxy setting and it worked like a charm on localhost/127.0.0.1/mac laptop eno IP addr or 0.0.0.0

ram dhakne
  • 926
  • 7
  • 3
0

In my case, I was using django-tenants and had to add the domain for the tenant in etc/hosts to get it working on localhosts. My entry for 127.0.0.1 now looks like

127.0.0.1 localhost test.localhost

theTypan
  • 5,471
  • 6
  • 24
  • 29
0

My problem was forgetting to select Environment. From the drop down where you see No Environment in the image, select the name of your environment.enter image description here

7guyo
  • 3,047
  • 1
  • 30
  • 31
0

Menuka Ishan's solution above saved my hours of pain! I left the Global Proxy Configuration switched ON and changed the Proxy Server to 127.0.0.1. Switched OFF the Use System Proxy. I already had the entry 127.0.0.1 localhost in my hosts file under the path C:\Windows\System32\drivers\etc.

Orby
  • 428
  • 1
  • 9
  • 24
0

If you have active proxy in your system then make sure Global Proxy Configuration and Use System Proxy are turned off. To do this go to Postman preferences > Proxy. You can also try sending a request in postman without typing localhost (e.g. :8080/send)

enter image description here

Redar
  • 83
  • 10
0

i think i also found a perfect fix. First you turn on global proxy configurations, add your local machine Ip which is 127.0.0.1,then also add localhost in the bypass. Also turn off SSL verification. It worked for me

Soji
  • 1
0

This worked for me, I disable the parameter host in the header.

HOST Disabled

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
EdoElric
  • 1
  • 1
0

If anyone is looking for a solution to WooCommerce local install, here are the steps to make this work:

  1. Go to Wordpress Admin > WooCommerce > Settings > Advanced
  2. Create new API key, give it a name
  3. Copy the Consumer Key & Consumer Secret to your text editor
  4. Open Postman
  5. Create new connection Set the URL for testing (GET) : http://mylocalsite/wp-json/wc/v3/orders (change "mylocalsite" to yours)
  6. Click on Authorization tab
  7. Now here is the main change: Although in WC Rest docs, it says to use the "Basic Auth" - IT WILL NOT WORK. Since usually your localhost is HTTP and not HTTPS. So "Basic Auth" is not relevant in our case.
  8. You will need to change the Authorization to OAuth 1.0
  9. Set Consumer Key & Consumer Secret respectively as it shows in Woocommerce
  10. Click "Send" - it should work now

If still you have problems, try one by one the following:

  1. File > Settings > Turn off SSL Verification
  2. File > Settings > Turn off "Automatically follow redirects"

enter image description here

Shir Gans
  • 1,976
  • 3
  • 23
  • 40
0

I had the same problem that couldn't get response from localhost. I downloaded postman to my computer desktop version then I could get back response.

sher
  • 15
  • 4