wrangler dev
seems to be only listening on ipv6?
#1198
Comments
Hey @iameli - that's a great find! Going to do some investigating to see how trivial it would be to get |
@iameli - I'm going to close this as won't do. unfortunately I can't figure out a good way to do this without allowing requests from non-loopback ips which would be a security issue. I think the workaround is sufficient in this case, provide an ip with the |
Please re-open this issue as this has me puzzled for hours. The same problem repros for Node.js HTTP requests, and this DNS issue is something that I've never encountered with any other dev / localhost servers. Example using got's dnsLookupIpVersion: These all fail: got('http://localhost:8787/test')
got('http://localhost:8787/test', { dnsLookupIpVersion: 'ipv4' })
fetch('http://localhost:8787/test') This works but is an awkward and unnecessary workaround: got('http://localhost:8787/test', { dnsLookupIpVersion: 'ipv6' }) What makes this such a nasty bug is that it was really difficult to track down since ECONNREFUSED on the client-side is so opaque and no amount of logging within the server helps. I also spent a while thinking it might be a CORS issue. |
unfortunately there doesn't seem to be a way for me to expose |
Thanks @EverlastingBugstopper π π |
You can do this without exposing to the local network, but it requires that you create multiple TcpListeners (one for 127.0.0.1 and one for ::1). The preferred way to do this is to call getaddrinfo and then bind to all of the returned addresses. Either hint SOCK_STREAM, or filter the returned results for SOCK_STREAM socktypes. Also you could probably pass None for the hostname instead of Some("localhost"), as long as you do not set the passive flag (otherwise it will return the any address instead of the loopback address). |
|
I'm seeing this currently with wrangler 2.0.24. Is it expected? Connecting to 127.0.0.1 does not work, but connecting to ::1 does. It took me a really long time to track this down. |
π Bug Report
Environment
rustc -V
: not using Rust, installed Wrangler from NPMnode -v
: v10.19.0wrangler -V
: π· β¨ wrangler 1.8.4Steps to reproduce
In one tab:
In another:
What did you expect to see?
The worker
What did you see instead?
Connection refused message
This one totally baffled me for a while until I realized I had my script configured to hit
127.0.0.1
andwrangler dev
was only listening on IPv6. Is this intentional? I can work around it if it is.EDIT: Looks like this can be worked around with
--ip 127.0.0.1
.The text was updated successfully, but these errors were encountered: