fix: Support arbitrary socket names in URL routing #29

Merged
mahmoud merged 1 commit from development_arbitrary_sockets into development 2026-04-09 12:34:17 +00:00
Owner

Problem

hero_router only recognizes fixed webnames: rpc, ui, admin, rest, api. Anything else maps to web_{name}.sock. This breaks services with custom socket names like explorer_rpc.sock:

GET /hero_compute/explorer_rpc/health
  -> looks for web_explorer_rpc.sock
  -> not found (actual socket is explorer_rpc.sock)

Fix

In the default match arm, check if {name}.sock exists on disk before falling back to web_{name}.sock:

let direct = format!("{}.sock", webname);
let sock_name = if sock_dir.join(service_name).join(&direct).exists() {
    direct
} else if webname == "ui" {
    "ui.sock"
} else {
    format!("web_{}.sock", webname)
};

Test plan

  • cargo clippy passes
  • Test on server: /hero_compute/explorer_rpc/health returns OK

Closes #28

## Problem hero_router only recognizes fixed webnames: rpc, ui, admin, rest, api. Anything else maps to `web_{name}.sock`. This breaks services with custom socket names like `explorer_rpc.sock`: ``` GET /hero_compute/explorer_rpc/health -> looks for web_explorer_rpc.sock -> not found (actual socket is explorer_rpc.sock) ``` ## Fix In the default match arm, check if `{name}.sock` exists on disk before falling back to `web_{name}.sock`: ```rust let direct = format!("{}.sock", webname); let sock_name = if sock_dir.join(service_name).join(&direct).exists() { direct } else if webname == "ui" { "ui.sock" } else { format!("web_{}.sock", webname) }; ``` ## Test plan - [x] cargo clippy passes - [x] Test on server: /hero_compute/explorer_rpc/health returns OK Closes #28
fix: support arbitrary socket names in URL routing
All checks were successful
Build & Test / check (push) Successful in 2m38s
Build & Test / check (pull_request) Successful in 2m32s
c6ed792555
Before: /{service}/{name}/* where name is not rpc/ui/admin/rest/api
mapped to web_{name}.sock. Custom sockets like explorer_rpc.sock
were unreachable.

Now: check if {name}.sock exists directly on disk first. Only fall
back to web_{name}.sock if the direct name doesn't exist.

Closes #28
Author
Owner

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

I have tested the flow on the Hero Compute, and it is working as well
mahmoud merged commit 7e500400d4 into development 2026-04-09 12:34:17 +00:00
mahmoud deleted branch development_arbitrary_sockets 2026-04-09 12:34:24 +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_router!29
No description provided.