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

ECONNREFUSED when connecting locally #108

Closed
clintandrewhall opened this issue Nov 22, 2011 · 3 comments
Closed

ECONNREFUSED when connecting locally #108

clintandrewhall opened this issue Nov 22, 2011 · 3 comments

Comments

@clintandrewhall
Copy link

I've enjoyed using request on a number of projects, but this problem has me stumped.

When attempting to use request to access a data-serving endpoint on my local machine on, say, port 3000, I get a ECONNREFUSED. Yet if I use a simple function using the http module, it processes normally.

Perhaps there is something wrong with my server code that would deny some header or agent set by this module, but I'm just not sure. I'm using Connect, which is pretty standard out of the box... any insight?

@mikeal
Copy link
Member

mikeal commented Feb 18, 2012

are you using listen(8000, function () { request('http://localhost:8000') })

that's probably what is happening, newer versions of node are really need you to wait for the listen callback to fire before connecting. closing until you respond.

@mikeal mikeal closed this as completed Feb 18, 2012
@MichaelTaylor3D
Copy link

I get this same error, my node is running on 8081 and Im trying to POST to another service that is running on my local machine on 8080. I can post to external websites fine it seems. Any ideas?

@vkhvst
Copy link

vkhvst commented Jun 7, 2016

are you binding to 0.0.0.0?
here's what worked for me for a server running rails/puma:
rails s -b 0.0.0.0

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

4 participants