Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Cannot access wrangler dev --ip 0.0.0.0 from device on same network #4763

Closed
selimjouan opened this issue Jan 17, 2024 · 3 comments
Labels
bug Something that isn't working

Comments

@selimjouan
Copy link

Which Cloudflare product(s) does this pertain to?

Wrangler core, Miniflare

What version(s) of the tool(s) are you using?

3.22.5, 3.22.3, 3.19.0, 3.18.0

What version of Node are you using?

18

What operating system are you using?

MacOS

Describe the Bug

Run wrangler dev --ip 0.0.0.0 and try accessing http://<local_ip>:8787 on a device on the same network.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

Hi!

With wrangler dev --ip 0.0.0.0 I can access the worker through http://192.168.1.26:8787 (local IP) on computer on which I started the process, but not from my phone on the same wifi network... (i can access other ports (http://192.168.1.26:5000), if I run a simple web server for example).

I tried different wrangler versions, nothing changed. Actually, it worked with 3.18.0 and --remote but remote development breaks my workflow...

If I forward a port to 8787 (with socat TCP-LISTEN:8282,fork TCP:localhost:8787) I can access the dev worker from my phone through http://192.168.1.26:8282.

Is this a bug or am I missing something?

@selimjouan selimjouan added the bug Something that isn't working label Jan 17, 2024
@Lekensteyn
Copy link
Contributor

I cannot reproduce the problem on Linux with wrangler 3.24.0 and wrangler dev --ip 0.0.0.0. On macOS, you can also check which address and ports a service is listening using:

lsof -nPiTCP -sTCP:LISTEN

Can you confirm that no firewall rule is denying external access to the node process?

@selimjouan
Copy link
Author

@Lekensteyn Yes I can confirm that there is no firewall denying external access to the node process. I can access other node servers from my phone but not workerd... Even though it's open when running lsof -nPiTCP -sTCP:LISTEN.

So far, I tried:

  • All rencent wrangler versions (3.14 to 3.26)
  • Connect from another phone
  • Connect from another browser
  • Other wifi networks
  • Launching wrangler on different ports (3000, 8282, 8787, 8888…)
  • Fresh new Cloudflare Worker project
  • Fresh new Cloudflare Worker project after creating on a new user on the Mac
  • All of the above while disabling firewall completely (and anti-virus)

Also I ran sudo tcpdump -i en0 port ${PORT} to listen to incoming connections: it does not go beyond the initial handshake when trying to access wrangler from the phone on the same device (works with other node servers as I said, and works when I forward a port to the wrangler on).

It looks like the workerd process is listening on the chosen port but refuses the connection from another device ip.

@selimjouan
Copy link
Author

After some further investigations, the issue seems to come from "special" MacOS folders (Desktop, Documents, Downloads), which, in my case, couldn't receive incoming connections.
I just started a new project outside of these folders and it is now working as expected!

I can conclude it is not a Wrangler issue, but a MacOS one...

@selimjouan selimjouan closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
None yet
Development

No branches or pull requests

2 participants