Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gwpl/7c5a32ffaacb891f5df6e962fd4b3900 to your computer and use it in GitHub Desktop.
Save gwpl/7c5a32ffaacb891f5df6e962fd4b3900 to your computer and use it in GitHub Desktop.
Solution to Puzzle: 127.0.0.1:1234 works, but localhost:1234 does not under https://gist.github.com/gwpl/92207935c22080490f311254cd6c8f33

Solution to Puzzle: 127.0.0.1:1234 works, but localhost:1234 does not

under https://gist.github.com/gwpl/92207935c22080490f311254cd6c8f33

When we force IPv4 or IPv6 we see problem:

$ curl -4 http://localhost:6942  # Force IPv4
{"message":"OpenRouter PHP Proxy","version":"1.0.0","status":"running"}$ 
$ curl -6 http://localhost:6942  # Force IPv6
curl: (56) Recv failure: Connection reset by peer

Browser via localhost tries to talk via IPv6 and curl by default as well (on given machine).

And server/docker is not configured to support IPv6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment