[erlang-questions] http:request/5 returns econnrefused for localhost

Jan Lehnardt <>
Tue Jun 24 08:43:35 CEST 2008

On Jun 24, 2008, at 03:08, Edwin Fine wrote:

> I have a really bizarre situation here.
> I have code using http:request that used to work, apparently until I  
> installed R12B-3 (or did something stupid to break something  
> somewhere). Now I get this bizarre situation where it will work with  
> a URL containing a numeric IP, but not "localhost". Whenever I use  
> localhost, I get {error,econnrefused}, but if I use or  
> it works. It always used to work with localhost. I even  
> replaced localhost in /etc/hosts with instead of  
> but to no avail. If I post to localhost via browser it works fine,  
> it's only http:request that is giving problems. I can ping localhost  
> no problem.
>  running in embedded mode on port 8888 of {0,0,0,0}.
> Can anyone suggest what might have gone wrong?

We have seen the same issue with CouchDB. What we found out
is that in our case localhost was not only resolving to (IPv4)
but also ::1 (IPv6) and that http:request() would try to connect to
::1 where no service was listening.

Try disabling IPv6 networking to verify this.


More information about the erlang-questions mailing list