Skip to content

fix: proxy /api to backend for eth_getBalance#53

Open
pthmas wants to merge 1 commit intomainfrom
pthmas/fix-eth-balance
Open

fix: proxy /api to backend for eth_getBalance#53
pthmas wants to merge 1 commit intomainfrom
pthmas/fix-eth-balance

Conversation

@pthmas
Copy link
Copy Markdown
Collaborator

@pthmas pthmas commented Apr 9, 2026

Summary

  • getEthBalance calls GET /api?module=account&action=balance&address=... (no trailing slash)
  • nginx only had location /api/ which doesn't match /api — the request fell through to the SPA catch-all, returning index.html instead of proxying to the backend
  • Add location = /api exact-match block to proxy the Etherscan-compatible endpoint correctly

Summary by CodeRabbit

  • Chores
    • Improved API request routing to ensure proper handling of API endpoints without trailing slashes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fbfe5f02-b67b-4619-a217-339306fc2523

📥 Commits

Reviewing files that changed from the base of the PR and between e1b3e31 and 1dfcdc6.

📒 Files selected for processing (1)
  • frontend/nginx.conf

📝 Walkthrough

Walkthrough

Added a new Nginx location block with exact-match for path /api that proxies requests to http://atlas-server:3000/api with header forwarding (Host, X-Real-IP, X-Forwarded-For). This complements the existing /api/ location block for deeper paths.

Changes

Cohort / File(s) Summary
Nginx Configuration
frontend/nginx.conf
Added exact-match location block for /api endpoint proxying to http://atlas-server:3000/api, forwarding Host, X-Real-IP, and X-Forwarded-For headers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop through the config so clean and so bright,
A new route for /api set perfectly right,
No trailing slash needed, exact match will do,
The proxies all dancing, now routing true! ✨🔧

🚥 Pre-merge checks | ✅ 3
✅ 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: adding an Nginx rule to proxy /api requests to the backend for the eth_getBalance endpoint, which is the core purpose of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pthmas/fix-eth-balance

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.

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