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

Ignatios Souvatzis <>
Tue Jun 24 11:46:13 CEST 2008


On Mon, Jun 23, 2008 at 09:08:57PM -0400, 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.

You should teach Yaws to listen also on IPv6 - "localhost" resolves not
only to IPv4 127.0.0.1, but also to IPv6 ::1.

Depending on operating system, "ping" only works with IPv4 and you have
to use "ping6" for IPv6 (that's because you need dirty tricks to write
a ping program for IPv4, and less tricks to write one for IPv6, so it's
easier to have a seperate one...)

Regards,
	Ignatios Souvatzis



More information about the erlang-questions mailing list