Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to localhost:8000 "Could not get any response" #2214

Closed
cpiggott opened this issue Aug 1, 2016 · 46 comments
Closed

Call to localhost:8000 "Could not get any response" #2214

cpiggott opened this issue Aug 1, 2016 · 46 comments

Comments

@cpiggott
Copy link

cpiggott commented Aug 1, 2016

I recently updated the Postman Mac application to 4.5.0 and I'm currently having issues getting a response from localhost.

I have tried multiple ports and restarted everything that I thought could be an issue(Postman, local Apache, server, etc.) I don't believe it is an issue with my server or apache. I can reach the localhost with Postman by using ngrok to POST/GET the URL that is tunneled to my localhost.

Not sure what the issue is, console isn't logging any errors either.

Version/App Information:

  1. Postman Version: 4.5.0
  2. App (Chrome app or Mac app): Chrome app
  3. OS details: OS x 15.0.0 x64
  4. Is the Interceptor on and enabled in the app: No
  5. Did you encounter this recently, or has this bug always been there: Latest update
  6. Expected behaviour: 200 OK
  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): Nothing
  8. Screenshots (if applicable)

Steps to reproduce the problem: Make a POST/GET request to localhost:xxxx while running a LAMP stack in development mode.

@abhijitkane
Copy link
Member

abhijitkane commented Aug 1, 2016

@cpiggott Can you check also check the Postman console (View -> Show Postman Console) for any errors?
Also, are you able to make requests to non-localhost endpoints? (GET http://echo.getpostman.com/get)

@abhijitkane abhijitkane added the bug label Aug 1, 2016
@cpiggott
Copy link
Author

cpiggott commented Aug 1, 2016

@abhijitkane I am able to connect to http://echo.getpostman.com/get and any other site, it's only happening with localhost.

Error: connect ECONNREFUSED 127.0.0.1:8080 is getting logged.

@abhijitkane
Copy link
Member

abhijitkane commented Aug 1, 2016

@cpiggott Can you try adding these two headers in the Postman UI:

Accept: */*
Accept-language: en-US,en;q=0.8

@cpiggott
Copy link
Author

cpiggott commented Aug 1, 2016

@abhijitkane Tested with the errors, still getting the same error.

@cpiggott
Copy link
Author

cpiggott commented Aug 1, 2016

@abhijitkane I ran a NodeJS server on port 9000 and I'm getting the expected response from it.

It may be something to do with Laravel, but I ran it this morning before updating and had no problem with my Laravel test server.

@abhijitkane
Copy link
Member

Are there any error/debug logs printed by your laravel server?

@cpiggott
Copy link
Author

cpiggott commented Aug 1, 2016

Nothing error/debug is being logged.

I can reach localhost:8080 from Chrome, but not Postman.

@czardoz
Copy link

czardoz commented Aug 1, 2016

@cpiggott Hope you don't mind me jumping in!
Does it also happen if you use 127.0.0.1 instead of localhost? Surprisingly, the error shown is a "ECONNREFUSED" which means that Postman could not even connect to the server.

@czardoz czardoz self-assigned this Aug 1, 2016
@knarz
Copy link

knarz commented Aug 2, 2016

I think I'm hitting a similar (the same?) problem.

After upgrading to 4.5.0 from 4.4.3 postman seems to be unable to talk to one of the daemons that I have running locally whereas a simple curl still works as expected. After downgrading to the previous version I can talk to the daemon in question normally again.

Response headers from the daemon that does not work with 4.5.0

< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Content-Length: 3021
< Connection: close

Response headers from a daemon that does work with 4.5.0

< HTTP/1.1 200 OK
< Date: Tue, 02 Aug 2016 16:00:11 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 26

@cpiggott
Copy link
Author

cpiggott commented Aug 2, 2016

@czardoz If I hit 127.0.0.1 I get a 200 OK.

If I try and hit 127.0.0.1:8080 I get the same response.

@capicue
Copy link

capicue commented Aug 2, 2016

I ran into this issue as well. It seems that Postman converts localhost to 127.0.0.1 before making the request. I happened to be serving a Rails app with Puma that was not listening on 127.0.0.1, only [::1]. They have since fixed this in Puma (puma/puma#782), but it seems like this will at first look like a Postman issue whenever a server disregards ipv4.

My symptoms were as follows:

In a browser:

In Postman:

@jpletner
Copy link

jpletner commented Aug 4, 2016

Same issue here. Works with http://[::1]:3000. Thank you @capicue!!!

@shamasis
Copy link
Member

shamasis commented Aug 5, 2016

Issue is fixed in 4.5.1 release. If I get one confirmation, I can close this issue. Let me know.

@knarz
Copy link

knarz commented Aug 6, 2016

Doesn't seem to fix it for me.

@czardoz
Copy link

czardoz commented Aug 6, 2016

@knarz can you tell us a few more details?

  1. What framework do you use?
  2. How do you start the server?
  3. What happens when, instead of localhost you use one of these values?
    1. 127.0.0.1: example: http://127.0.0.1:8080/my/url
    2. "::1" , example: http://[::1]:8080/my/url
  4. Contents of your /etc/hosts file. (Feel free to leave out sensitive entries, I'm mostly interested in the localhost entries :)

@knarz
Copy link

knarz commented Aug 6, 2016

Sure.

  1. The daemon that I cannot contact with the new version is written in Java, not sure which framework. As stated before, a simple curl works just fine, as does version 4.4.3.
  2. java -jar server.jar.
  3. Neither of those make the request succeed.
127.0.0.1 localhost
::1       localhost 

@cpiggott
Copy link
Author

cpiggott commented Aug 8, 2016

Update to 4.5.1 fixed the issue for me.

@ywang-clarify
Copy link

I'm seeing this problem in the Windows app version 4.6.1.
Requests to http://localhost:3000/stuff fail with no response.
Requests to http://127.0.0.1:3000/stuff works fine.

The Chrome app (version 4.6.0) works fine with http://localhost:3000/stuff

@rahulsivalenka
Copy link

This issue exists in the latest Chrome app Postman 4.9.0.

http://localhost:3100/test fails
http://127.0.0.1:3100/test works

@devjamie
Copy link

devjamie commented Feb 8, 2017

I'm having this issue too 4.9.3

@airs0urce
Copy link

This is what I see in console when get that error:
https://dl.dropboxusercontent.com/u/1875424/Screen%20Shot%202017-02-11%20at%2012.08.10%20AM.png

I have same error when I send request from node.js application written by me.
I suppose Postman uses node.js too.
In my app I have a little more debug information, and I see "HPE_INVALID_CONSTANT":

"message":"Error: Parse Error","cause":{"bytesParsed":278,"code":"HPE_INVALID_CONSTANT"

which means there is issue with parsing response. May be something wrong with response headers for example. I had this issue before and it was because server was returning wrong value in "Content-length" header, for example, Content-length: 10, but real length of body is 5. PHP will handle this case without issues, but node.js don't ignore it and throw HPE_INVALID_CONSTANT and "Parse Error".
As solution to handle errors like these (and if I'm right about Postman written with node.js, as I didn't check it) it makes sense to replace http parser by this one:
https://www.npmjs.com/package/http-parser-js

And I think it should let Postman work even with http servers that return invalid headers.

@Chobicus
Copy link

Postman's response is confusing.
I was getting no response because I had one of the header names with quotes.
Postman would respond with:

Could not get any response

The console output is:

Error:
Header name must be a valid HTTP Token [""Invheader""]

@sdnts
Copy link

sdnts commented Feb 13, 2017

The native Postman apps do run on a NodeJS sandbox, so that could be a possibility.
@Chobicus @airs0urce Is this misbehaviour only observed with localhost and not 127.0.0.1?

@sdnts sdnts reopened this Feb 13, 2017
@airs0urce
Copy link

@madebysid It's not only on localhost. As I got an API (private), and saw there is "Parse Error" when I implemented that API in node.js. Then I decided to test it in Postman and saw same error. I also tried "Rested" HTTP client for macOS, and it returned response without issues. So, issue happens only in node.js and error message is "Parse Error".
This module solves the issue: https://www.npmjs.com/package/http-parser-js
I suppose something wrong with HTTP response format and node.js can't eat everything.
But when I try to reproduce for example wrong Content-length on local machine, Postman and node.js works good, issue happens only for certain servers. May be because there is proxying of http requests and that proxy change something more, not only Content-length. It's hard to tell why error appears.

@blarzHernandez
Copy link

@tokidoki11
Copy link

I'm facing the same problem as well.
In my case adding Header x-access-token

if I remove the header, it works fine

@agolendukhin
Copy link

agolendukhin commented Jun 26, 2017

firewall can block 8000 port also, e.g. antivirus's one.

@ms-OrionCox
Copy link

Turn off SSL Certificate Verification in Settings>General

@magasea
Copy link

magasea commented Oct 1, 2017

close your interceptor

@caddac
Copy link

caddac commented Nov 7, 2017

I was having this same issue on Mac postman 5.3.2, turns out I had an incorrect header, I had this error in the console: Error: Header name must be a valid HTTP Token. Seems like that error should be displayed to the user?

@lvian
Copy link

lvian commented Nov 28, 2017

Was having the same problem using the Windows App accessing a linux server running on vagrant.

Had to ditch the windows app and use the browser version, working like a charm now.

@a85
Copy link
Contributor

a85 commented Dec 11, 2017

Closing this issue as there might be multiple reasons for this request to not work. Does not seem to be a particular problem with the postman-runtime.

@a85 a85 closed this as completed Dec 11, 2017
@Rylai-Zihang
Copy link

How about error"Error: socket hang up" in console view of postman?
I've tried to turn off SSL but not work.
I visited by IP.
My backend is OK.

@haraujo83
Copy link

hi. i'm having the same problem...
when i use a different port, it show error "Could not get any response"
my postman version is the newest (6.0.10 - windows)
the chrome app version it works fine for me

@BobGerman
Copy link

Turning off SSL certificate validation worked for me (debugging w/VS2017 ASP.NET Core 2.0)

@ShabbirGithub
Copy link

I had envronment variables 'http_proxy' and 'https_proxy' that were preventing me to get to localhost. Removing the environment variables did the trick.

@seabamirum
Copy link

I have SSL certificate validation off, but it still didn't work. Changing localhost to [::1] (whatever that means) fixed it.

@baibhavtripathi
Copy link

I was having this same issue on Mac postman, Version 7.0.7 (7.0.7).

'/' at the end in requests, did the job for me.

@haugstve
Copy link

I tested today using netcat on mac:
nc -lk localhost 3000

In chrome, requests are printed when I write
localhost:3000
http://[::1]:3000/

Postman only works when using
[::1]:3000
when writing
localhost:3000
I get errors (not the same for all requests even if they are identical). Once it actually worked(not able to reproduce). I think the different errors and results might be correlated with chrome doing requests at the same time but my understanding of this is rudamentary.

The two errors are
Error: write EPIPE
Error: connect ECONNREFUSED 127.0.0.1:3000

@yogiiiii26
Copy link

yogiiiii26 commented Mar 13, 2020

When I'm trying to use POST operation through local host server. It is not connecting to the server and showing the following error : There was an error connecting to http://localhost:4500/api/user/signup

Can someone please help here?

image

@airs0urce
Copy link

@yogiiiii26 So, when you open this URL in browser it works?
http://localhost:4500/api/user/signup

but when you request it in Postman it doesn't?
May be you blocked network for Postman in firewall settings.

@yogiiiii26
Copy link

Hi @airs0urce thanks for the suggestion but after doing this also the error is still the same.

@Gitanjali86
Copy link

Gitanjali86 commented May 11, 2021

Hi ! Can I have solution for this localhost issue plssss?
I am able to access via chrome browser but not via Postman.
https://localhost:8080/
I am using V8.4.0

@krishna066
Copy link

postman is not able to connect to localhost:3000.
disabled SSH and proxy in settings, but no luck.
It's loading continuously, not even showing any error.

Postman version:9.23.3
System used: Mac

@shubhbhargav
Copy link

@krishna066 Are you able to access the above url via any other method? I am assuming that you are using the desktop version of Postman (not web). Let me know if that's not the case.

@Gitanjali86 Can you please share a screen recording of the issue? It will help us debug the issue further.

@krishna066
Copy link

Hi @shubhbhargav, I'm using the desktop version and my issue got fixed after I downgraded the node version in my machine.

Thank You.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests