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

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


Heya,
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 0.0.0.0 or  
> 127.0.0.1 it works. It always used to work with localhost. I even  
> replaced localhost in /etc/hosts with 0.0.0.0 instead of 127.0.0.1  
> 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 127.0.0.1 (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.

Cheers
Jan
--



More information about the erlang-questions mailing list