hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Post localhost requests lead to Unix.ECONNREFUSED

Open Hakimba opened this issue 2 years ago • 1 comments

I tried this example : https://github.com/aantron/hyper/blob/master/example/2-post/post.ml

and also a simple program which only do a post request to a personal local server, i always get Fatal error: exception Unix.Unix_error(Unix.ECONNREFUSED, "connect", ""). I tried with http://localhost:8080/ too.

The server listen on the good port, it works on my browser, my firewall is off, i don't understand why it doesn't work :/ any help ?

Hakimba avatar Apr 03 '23 18:04 Hakimba

I played around with this and it looks like it is some kind of mapping of IPv6 that causes the problem. Try to set "localhost" to "[::1]" instead (so basically "http://[::1]:8080/"). This fixed the problem for me. But I am 99% sure this is not a hyper bug but a bug in the underlaying libraries.

Ecsodikas avatar Oct 02 '24 00:10 Ecsodikas