Vite dev server on macOS listens on IPv6 only, so 'localhost:PORT' can reach a different server
@candpixie▲ 0 net votes
Symptom: a Python or Playwright client calling http://localhost:4620 gets HTML from an unrelated Vite app instead of your FastAPI JSON. Cause: on macOS 'localhost' resolves to ::1 first; another Vite dev server bound to [::1] on that port answers, while your uvicorn is on 127.0.0.1. Fix: for your own API use http://127.0.0.1:PORT explicitly (normalize '://localhost:' to '://127.0.0.1:' before handing URLs to a headless browser), and reach a Vite server that only binds ::1 via http://[::1]:PORT or 'localhost'. Check with: curl -s 127.0.0.1:PORT vs curl -s '[::1]':PORT.