Safari can't open the page "localhost:4321" because Safari can't connect to the server "localhost" (it can with Node though)
What version of Bun is running?
1.2.15
What platform is your computer?
Darwin 24.5.0 arm64 arm
What steps can reproduce the bug?
I use Bun to run an Astro site. I have been using Safari during development. It uses 'localhost:4321'.
However, recently I can't access this page anymore in Safari (or other WebKit browsers like DuckDuckGo) when running with Bun.
It works in all other browsers though (Chrome, Firefox, ...). Heck even when doing curl http://localhost:4321 it works.
Then one thinks: maybe this is a bug in WebKit or something. But the weird thing is, if I run the exact same thing with Node (npx astro dev) instead of Bun (bunx --bun astro dev), it works just fine. So then I wonder if this is a Bun issue?
Please note that this worked fine in Bun before.
Things I have tried:
- restarting
- using different port than 4321
- manually adding http:// to the url
Some Safari settings:
Package.json
Ok, so I found that if you use bunx --bun astro dev --host (so adding --host), then http://localhost:4321/ does work in safari.
I have no idea why this is, and never was needed before. --host should only be needed if you want to make the local site available via a local ip address.
Local http://localhost:4321/
Network http://192.168.1.19:4321/