feat: Forward service traffic to hero_router instead of direct socket access #20

Merged
mahmoud merged 1 commit from development_router_forwarding into development 2026-04-09 12:33:29 +00:00
Owner

Summary

hero_proxy no longer does its own socket discovery. All service requests are forwarded to hero_router at localhost:9988.

Flow

Before: Network -> hero_proxy -> Unix sockets (direct)
After: Network -> hero_proxy -> hero_router:9988 -> Unix sockets

Changes

  • Replace socket lookup with forward_to_upstream() to hero_router
  • Remove dead code: extract_two_segment_prefix, not_found_page (~190 lines removed)
  • Add router_url to AppState (env: HERO_ROUTER_URL, default: http://127.0.0.1:9988)
  • Add create_app_state_with_router() for tests
  • Test harness spawns mock hero_router per test (no shared env var, no race conditions)

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • All tests pass (26 passed, 0 failed, run 3x for flakiness)
  • Live test: hero_proxy -> hero_router -> hero_compute on server

Closes #19

## Summary hero_proxy no longer does its own socket discovery. All service requests are forwarded to hero_router at localhost:9988. ## Flow **Before:** `Network -> hero_proxy -> Unix sockets (direct)` **After:** `Network -> hero_proxy -> hero_router:9988 -> Unix sockets` ## Changes - Replace socket lookup with `forward_to_upstream()` to hero_router - Remove dead code: `extract_two_segment_prefix`, `not_found_page` (~190 lines removed) - Add `router_url` to AppState (env: `HERO_ROUTER_URL`, default: `http://127.0.0.1:9988`) - Add `create_app_state_with_router()` for tests - Test harness spawns mock hero_router per test (no shared env var, no race conditions) ## Test plan - [x] `cargo clippy --workspace --all-targets -- -D warnings` passes - [x] All tests pass (26 passed, 0 failed, run 3x for flakiness) - [x] Live test: hero_proxy -> hero_router -> hero_compute on server Closes #19
feat: forward service traffic to hero_router instead of direct socket access
All checks were successful
Test / test (push) Successful in 1m26s
Test / test (pull_request) Successful in 1m24s
8ad256ac2d
hero_proxy no longer does its own socket discovery and routing. All
service requests (/{service}/*) are forwarded to hero_router at
localhost:9988 (configurable via HERO_ROUTER_URL env var).

hero_router handles socket discovery, prefix stripping, and header
injection. hero_proxy handles network (Mycelium/TLS), auth, and
domain routing.

Flow: Network -> hero_proxy -> hero_router -> Unix sockets

- Replace socket lookup (find_socket_for, find_socket_by_name) with
  forward_to_upstream() call to hero_router
- Remove extract_two_segment_prefix and not_found_page (dead code)
- Add router_url to AppState (default: http://127.0.0.1:9988)
- Add create_app_state_with_router() for testing
- Update test harness with mock hero_router (TCP server that routes
  to mock backend sockets)

Closes #19
Author
Owner

I have tested the flow on Hero Compute, and it is working as well

I have tested the flow on Hero Compute, and it is working as well
mahmoud merged commit c2c9725ab9 into development 2026-04-09 12:33:29 +00:00
mahmoud deleted branch development_router_forwarding 2026-04-09 12:33:34 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_proxy!20
No description provided.