Fix: Force IPv4 in Vite proxy to resolve Windows ::1 ECONNREFUSED error#260
Fix: Force IPv4 in Vite proxy to resolve Windows ::1 ECONNREFUSED error#260Thevishal-kumar wants to merge 1 commit intoAOSSIE-Org:mainfrom
Conversation
📝 WalkthroughWalkthroughThe Vite development server proxy configuration was updated to redirect API requests from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Frontend/vite.config.ts (1)
16-16: Fix correctly addresses the Windows IPv6 dev environment issue.The change from
localhost:8000to127.0.0.1:8000in the Vite dev server proxy directly solves the Windows ECONNREFUSED error by forcing IPv4 resolution. The proxy configuration is development-only and applies universally across platforms.Optional: Consider adding a comment explaining why
127.0.0.1is used instead oflocalhostto clarify this is a Windows IPv6 workaround:server: { proxy: { + // Use 127.0.0.1 instead of localhost to force IPv4 and avoid Windows ::1 resolution issues '/api': 'http://127.0.0.1:8000', }, },
Description
I encountered a network connection error on Windows where the frontend could not communicate with the backend, resulting in the error: Error: connect ECONNREFUSED ::1:8000.
This happens because localhost often resolves to IPv6 (::1) on Windows, but the Python backend listens on IPv4 (127.0.0.1). This PR fixes the vite.config.ts proxy settings to explicitly use the IPv4 address, ensuring consistent connectivity.
Changes Made
Config: Updated Frontend/vite.config.ts proxy target from http://localhost:8000 to http://127.0.0.1:8000.
📷 Screenshots or Visual Changes (if applicable)

Terminal: The error http proxy error: /api/trending-niches no longer appears in the logs.
before fix:
After Fix:

App: The frontend can now successfully fetch data from the backend API.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.