266

I am using postman to test an API I have, all is good when the request does not contain sub-domain, however when I add a sub-domain to URL I am getting this response.

Could not get any response

There was an error connecting to http://subdomain.localhost:port/api/

Why this might have happened:

The server couldn't send a response:Ensure that the backend is working properly

Self-signed SSL certificates are being blocked:Fix this by turning off 'SSL certificate verification' in Settings > General

Proxy configured incorrectly Ensure that proxy is configured correctly in Settings > Proxy

Request timeout:Change request timeout in Settings > General

If I copy the same URL from postman and paste it into the browser I get a proper response, is there some kind of configurations I should do to make postman work with sub-domains?

Yahya Hussein
  • 8,767
  • 15
  • 58
  • 114
  • 1
    I've mainly run into timeout issues when there was something like not being connected to a VPN, a runaway process server-side. Could there be something missing in your request headers, or CORS config? – Ed Meacham Dec 14 '17 at 19:41
  • 1
    if this is the case, should not I get like "bad request", "unauthorized" or something similar? – Yahya Hussein Dec 14 '17 at 19:44
  • 1
    For a routing issue, you would most definitely get a 40x. If it's a whitelist/VPN issue you should be getting a 40x as well... I have no idea how the service is configured, but when using Postman, your request will be coming from a different origin--so, a potential whitelist issue. You should be able to do some basic debugging on the server-side to see if you're even getting to the controller for your endpoint... – Ed Meacham Dec 14 '17 at 19:57
  • 1
    I see, if it is a white list issue, will it work for localhost/api and will not for subdomain.localhost/api? no it is not getting to the controller – Yahya Hussein Dec 14 '17 at 20:04
  • @YahyaHussein try to send USER_AGENT Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 with the postman in header. does it work in postman then? – jit Dec 20 '17 at 05:47
  • unfortunately no – Yahya Hussein Dec 20 '17 at 06:10
  • The only thing I could find is including subdomain.localhost in my hosts file as localhost – Yahya Hussein Jan 10 '18 at 16:04
  • 1
    I think many of the times there is something wrong with the application and not Postman. I debugged my Application and checked in the output window in Visual Studio, and found out there were reference loops between my entities. After i fixed this the problem was gone. – Desell Mar 01 '19 at 08:51
  • i am facing a similar issue, making a get request through postman is giving "couls not get response" where as the same is working from browser. I have turnedoff ssl and default system proxy is chosen. Please help me. – raj240 Oct 28 '20 at 04:58

33 Answers33

569

First Go to Settings in Postman:

  1. Off the SSL certificate verification in General Tab:

  1. Off the Global Proxy Configuration and Use System Proxy in Proxy Tab:

  1. Make Request Timeout to 0 (Zero)

Configure Apache:

If the above changes resulted in a 404 response, then continue reading ;-)

Users that host their site locally (like with XAMP and/or WAMP), may be able to visit their virtual sites using https:// prefixed address, but it's a lie, and to really enable SSL (for each virtual-site), configure Apache like:

  • Open httpd-vhosts.conf file (from Apache's conf/extras directory), in your preferred text editor.

  • Change the virtual site's settings, into something like:

<VirtualHost *:80 *:443>
    ServerName my-site.local
    ServerAlias *.my-site.local
    DocumentRoot "C:\xampp\htdocs\my-project\public"

    SSLEngine on
    SSLCertificateFile "path/to/my-generated.cert"
    SSLCertificateKeyFile "path/to/my-generated.key"

    SetEnv APPLICATION_ENV "development"

    <Directory "C:\xampp\htdocs\my-project\public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow, deny
        Allow from all
    </Directory>
</VirtualHost>

But of course, generate a dummy-SSL-certificate, and change all file paths, like from "path/to/my-generated.cert" into real file addresses.

  • Finally, test by visiting the local site in the browser, but using http:// (without S) prefixed address; Apache should now give error like:
Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Ramesh R
  • 7,009
  • 4
  • 25
  • 38
  • Have you followed all steps, Just now i modified it worked for me – Ramesh R Feb 27 '18 at 13:59
  • 1
    if you don't have ssl option you have to download postman from here : www.getpostman.com – Abdullah Tahan Oct 10 '18 at 12:16
  • Download from: 1) https://www.getpostman.com/apps 2) https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en – Ramesh R Oct 10 '18 at 12:20
  • 23
    Just turning off the ssl certification worked for me – devcodes Feb 13 '19 at 04:41
  • This settings does not work form me. Any other suggestions? – Čamo Apr 01 '19 at 08:21
  • Download the latest version and change the settings – Ramesh R Apr 08 '19 at 09:42
  • 4
    It worked like a charm, but my confusion is, why did it worked for QA, but not for DEV. Anyway, both of them works fine now. Thanks again. – raja777m May 07 '19 at 15:12
  • 35
    I love how this answer gets so many upvotes when it literally tells you the same things the error message said to do. – georgiaboy82 Jun 20 '19 at 17:09
  • don't forget, your timeout might be too low (it's in ms) – ahnbizcad Apr 08 '20 at 02:08
  • This worked for me but I ran into the same problem as @raja777m where I needed to do this on my work machine, but my home machine I didn't. Turns out I had Fiddler running too and that was causing the issue! – Crob Apr 09 '20 at 20:52
  • before going through all this pain do also verify if issue is because you are trying to access http resource over https and vice versa – TechnicalSmile Sep 10 '20 at 08:53
  • i am facing the issue even after turning off the ssl and enabled default system proxy, where as the same get request works fine in chrome browser. i wonder what is going wrong. – raj240 Oct 28 '20 at 05:00
241

I had the same issue. It was caused by a newline at the end of the "Authorization" header's value, which I had set manually by copy-pasting the bearer token (which accidentally contained the newline at its end)

Cool.wen
  • 2,559
  • 1
  • 7
  • 4
67

If you get a "Could not get any response" message from Postman native apps while sending your request, open Postman Console (View > Show Postman Console), resend the request and check for any error logs in the console.

Thanks to numaanashraf

Chris
  • 1,122
  • 1
  • 12
  • 14
  • 5
    Very helpful. I think I needed to disable the ssl certs, but I had added a bad header, and the console spelled that out for me. – MattC Sep 25 '19 at 13:33
  • 2
    This pointed me in the right direction; in my case the console log gave a much clearer error than Postman did: "Error: Invalid character in header content ["Authorization"] Warning: This request did not get sent completely and might not have all the required system headers". – Peter W Jan 31 '20 at 03:50
  • 1
    This should be the accepted answer since it helps you understand the underlying cause and not just guess it (e.g. "invalid character in header"). – Alexei - check Codidact Mar 04 '20 at 16:29
  • yep, had a "%0A" new line in the end, thanks to Google Docs.... :(((( – Tim Friedland Jan 04 '21 at 13:50
19

Hi This issue is resolved for me.

setting ->general -> Requesttimeout in ms = 0

kishor soneji
  • 795
  • 1
  • 9
  • 16
14

If all above methods doesn't work check your environment variables, And make sure that the following environments are not set. If those are set and not needed by any other application remove them.

HTTP_PROXY
HTTPS_PROXY

Reference link

arjuncc
  • 3,227
  • 5
  • 42
  • 77
  • 2
    I can't believe it still occurs in 2019.What if my others apps need those env params :( – Persk Aug 14 '19 at 04:38
9

For me it was the http://localhost instead of https://localhost.

Udit Jain
  • 137
  • 1
  • 2
6

When getting the following error, enter image description here

you need to do the following.

Step 1: In Postman, click the wrench icon, go to settings, then go to the Proxy tab.

Step 1 Wrench Icon > Settings > Proxy Tab

Step 2: Create a custom Proxy. This article explains how to create a custom proxy. After you create the custom Proxy, make sure you turn the Proxy toggle button to off. I put 61095 in for the proxy server and it worked for me.

enter image description here

Step 3 :

Success

Success

  • 5
    Can you explain why a Proxy would be necessary to access a server on the local network that is having this problem? – robross0606 Feb 05 '19 at 20:16
6

I came up with this solution

  1. In postman go to setting --> proxy
  2. And off Global Proxy Configuration
  3. on the Use System Proxy enter image description here

  4. And go to windows host configure file 'C:\Windows\System32\drivers\etc\hosts'

  5. Open that file in administrator mode
  6. And add the sub domain to hosts file enter image description here
Rasika Weragoda
  • 936
  • 14
  • 15
3

For me what worked was to add 127.0.0.1 subdomain.localhost to my host file. On OSX that was /etc/hosts. Not sure why that was necessary as I could reach the subdomain from chrome.

JSWilson
  • 1,113
  • 1
  • 11
  • 28
2
  1. In postman go to setting --> proxy
  2. And off Global Proxy Configuration

enter image description here

nthaih
  • 71
  • 3
1

For me, it was that route that I was calling in my node server wasn't returning anything. Adding

    return res.status(200).json({
        message: 'success!',
        response: 'success!'
    });//

to the route I was calling resolved the issue.

ContextSwitch
  • 2,830
  • 6
  • 35
  • 51
1

You mentioned you are using a CER certificate.

According to the Postman page on certificates.

Choose your client certificate file in the CRT file field. Currently, we only support the CRT format. Support for other formats (like PFX) will come soon.

The name of the extension CER, CRT doesn't make the certificate that type of certificate but, these are the excepted extensions names.

CER is an X.509 certificate in binary form, DER encoded.

CRT is a binary X.509 certificate, encapsulated in text (base-64) encoding.

You can use OpenSSL to change a CER file into a CRT file. I have not had good luck with it but it looks like this.

openssl x509 -inform PEM -in certificate.cer -out certificate.crt

or

openssl x509 -inform DER -in certificate.cer -out certificate.crt

GeekMustHave
  • 369
  • 3
  • 3
1

Postman for Linux Version 6.7.1 - Ubuntu 18.04 - linux 4.15.0-43-generic / x64

I had the same problem and by chance I replaced http://localhost with http://127.0.0.1 and everything worked.

My etc/hosts had the proper entries for localhost and https://localhost requests always worked as expected.

I have no clue why changing localhost for http with 127.0.0.1 solved the issue.

Harmlezz
  • 7,972
  • 27
  • 35
1

None of these solutions works for me. Postman is not sending any request to the server because postman is not finding the host. So, if you modify your /etc/hosts to 127.0.0.1 localhost 127.0.0.1 subdomain.localhost

It works for me.

gsumk
  • 809
  • 10
  • 15
1

For me the issue was that the Content-Length was too big. I placed the content of the body in NotePad++ and counted the characters and put that figure in PostMan and then it worked.

I know it does not directly answer why the op's sub-domain was not working but it might help out someone.

Darren
  • 1,352
  • 5
  • 19
  • 49
  • The Postman returns the same error even if you send HTTP header `content-encoding: gzip` but the content is not gzipped. See https://stackoverflow.com/a/52854400/2988107 – Mišo May 29 '19 at 06:00
1

invisible spaces

In my case it was invisible spaces that postman didn't recognize, the above string of text renders as without spaces in postman. I disabled SSL certificate Validation and System Proxy even tried on postman chrome extension(which is about to be deprecated), but when I downloaded and tried Insomnia and it gave those red dots in the place where those spaces were, must have gotten there during copy/paste

Yash Vardhan
  • 370
  • 2
  • 7
1

For anyone who experienced this issue with real domain instead of localhost and couldn't solve it using ANY OF THE ABOVE solutions.

Try changing your Network DNS (WIFI or LAN) to some other DNS. For me, I used Google DNS 8.8.8.8, 8.8.4.4 and it worked!

enter image description here

Cuong Vu
  • 3,423
  • 14
  • 16
1

solution is very simple if you are using asp.net core 2 application . Inside ConfigureServices method inside startup.cs file all this line

services.AddMvc()
                .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
                .AddJsonOptions(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
tapos ghosh
  • 2,114
  • 23
  • 37
1

You just need to turn SSL off to send your request.

Proxy and others come with various errors.

0

After all the above methods like turning OFF SSL certificate verification, turning ON only Use System Proxy and removing HTTP_PROXY and HTTPS_PROXY system environment variables, it worked.

Note: Had to restart the Postman app, since the environment variables were changed.

0

Unchecking proxy and SSL Certificate Verification didn't work for me.

Unsetting PROXY environment variables did the trick.

export http_proxy=
export ftp_proxy=
export https_proxy=

Change to the directory where Postman is installed and then:

./Postman
0

In my case, MVC wasn't able to serialize the results (I accidentally used a model instead of DTO). I debugged down to passing a simple string, which worked. Once I fixed the serialization it all came up.

mgPePe
  • 5,677
  • 12
  • 52
  • 85
0

In my case the (corporate) proxy was using a self-signed SSL certificate which Postman disliked. I discovered it by activating View->Show Postman console and retrying the request. The console then showed the certificate error. In Settings->General I disabled SSL certificate verification.

koljaTM
  • 10,064
  • 2
  • 40
  • 42
0

The solution for me, as I'm using the deprecated Postman extension for Chrome, to solve this issue I had to:

  1. Call some GET request using the Chrome Browser itself.
  2. Wait for the error page "Your connection is not private" to appear.
  3. Click on ADVANCED and then proceed to [url] (unsafe) link.

After this, requests through the extension itself should work.

MightGod
  • 436
  • 2
  • 8
  • 19
0

In my case it was a misconfigured subnet. Only one of the 2 subnets in the ELB worked.

I figured this out by doing a nslookup and trying to curl the returned IPs directly. Only one worked. Postman just kept using the misconfigured one.

M.Vanderlee
  • 2,847
  • 2
  • 19
  • 16
0

I had the same issue.

Turned out my timeout was set too low. I changed it to 30ms thinking it was 30sec. I set it back to 0 and it started working again.

Simon
  • 97
  • 7
0

I got the same "Could not get any response" issue because of wrong parameter in header. I fixed it by removing parameter HOST out of header.

PS: Unfortunately, I was pushed to install the other software to get this information. It should be great to get this error message from Postman instead of getting general nonsense.

Michal Jurník
  • 820
  • 1
  • 8
  • 23
0

In my case, I forgot to set the value of the variable in the "CURRENT VALUE" field.

Roman Grinyov
  • 222
  • 2
  • 5
  • 20
0

In my case, The issue was that for the UAT environment, the API URL will start with http instead of https. Also, the backend assigns different ports for both http and https.

for example,

http://10.12.12.31:2001/api/example. - is correct for me

https://10.12.12.31:2002/api/example. - is wrong for me

Because I was using https and 2002 port for hitting the UAT environment. So I am getting could not get any response error in postman.

Ramesh R
  • 7,009
  • 4
  • 25
  • 38
AnshulJS
  • 308
  • 3
  • 10
0

I just experienced this error. In my case, the path was TOO LONG. So url like that gave me this error in postman (fake example)

http://127.0.0.1:5000/api/batch/upload_import_deactivate_from_ready_folder

whereas

http://127.0.0.1:5000/api/batch/upld_impt_deac_ready_folder

worked fine.

Hope it helps someone who by accident read that far...

Alexander B.
  • 626
  • 6
  • 21
0

We got this confusing error when a user accidentally copy/pasted a leading space character in an environment variable used to build the URL:

Example:

The request's URL was set to: http://{URL}/blah

The {URL} environment variable had a value of " hostname" (**notice the leading space character**)

This caused Postman to try to access http:// hostname/blah which gave this error message.

Beau Harder
  • 1,062
  • 1
  • 7
  • 7
0

My issue was by putting wrong parameters in the header, the requested parameters was

Authorization: Token <string>

and is was trying

Authorization Token: <string>
0

Normal http request was giving this error, but when I changed to https, then started working. Issue faced when running in localhost.

Arun Prasad E S
  • 9,489
  • 8
  • 74
  • 87