Skip to content

Conversation

@Thevishal-kumar
Copy link

@Thevishal-kumar Thevishal-kumar commented Dec 30, 2025

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:
Screenshot 2025-12-30 130158

After Fix:
image

App: The frontend can now successfully fetch data from the backend API.

Summary by CodeRabbit

  • Chores
    • Updated development server configuration for API request routing.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

The Vite development server proxy configuration was updated to redirect API requests from localhost:8000 to 127.0.0.1:8000. This is a hostname string substitution in the dev server configuration with no changes to control flow or error handling.

Changes

Cohort / File(s) Summary
Vite Configuration
Frontend/vite.config.ts
Updated dev server proxy target hostname from localhost to 127.0.0.1 for /api path routing

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A hop to the numbered address so fine,
127.0.0.1, the loopback line,
No localhost needed, we've changed our way,
The API awaits, hip-hip-hooray! 🐰

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the Vite proxy target from localhost to 127.0.0.1 to force IPv4 and resolve the Windows ECONNREFUSED error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:8000 to 127.0.0.1:8000 in 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.1 is used instead of localhost to 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',
    },
  },
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3be437 and bb28ba6.

📒 Files selected for processing (1)
  • Frontend/vite.config.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant