fix(route): update backend URL handling for internal Docker network#1459
Conversation
- Modified backend URL assignment to ensure it resolves correctly within the internal Docker network, preventing 503 errors for authenticated Zero queries. - Added comments to clarify the routing behavior and the necessity of using the internal backend URL.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe zero query API route's backend URL is now derived from an internal FastAPI backend environment variable with fallbacks to external URL and a default localhost endpoint, and the URL is normalized by removing trailing slashes. ChangesZero Query Internal Backend Routing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR fixes a backend URL resolution issue for server-to-server communication within Docker containers. The route handler now prioritizes
FASTAPI_BACKEND_INTERNAL_URLfor internal Docker network communication (e.g.,http://backend:8000) over the browser-facing URL, preventing 503 errors during authenticated Zero queries when the zero-cache system invokes this route server-side.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_web/app/api/zero/query/route.tsSummary by CodeRabbit