fix: Support arbitrary socket names in URL routing #28

Closed
opened 2026-04-09 10:31:36 +00:00 by mahmoud · 0 comments
Owner

Problem

hero_router only recognizes these webnames: rpc, ui, admin, rest, api. Any other name in /{service}/{name}/* maps to web_{name}.sock.

This breaks hero_compute which has 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 (routes.rs ~line 996), before constructing web_{name}.sock, check if {name}.sock exists directly on disk:

_ => {
    // Try direct socket name first (e.g. explorer_rpc.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".to_string()
    } else {
        format!("web_{}.sock", webname)
    };

This way any .sock file a service creates is automatically routable by its filename, without needing to register it as a known type.

  • hero_compute#83 -- multi-node connectivity uses explorer_rpc.sock
  • hero_proxy#19 -- hero_proxy forwards to hero_router, which must handle all socket types
## Problem hero_router only recognizes these webnames: `rpc`, `ui`, `admin`, `rest`, `api`. Any other name in `/{service}/{name}/*` maps to `web_{name}.sock`. This breaks hero_compute which has `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 (routes.rs ~line 996), before constructing `web_{name}.sock`, check if `{name}.sock` exists directly on disk: ```rust _ => { // Try direct socket name first (e.g. explorer_rpc.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".to_string() } else { format!("web_{}.sock", webname) }; ``` This way any `.sock` file a service creates is automatically routable by its filename, without needing to register it as a known type. ## Related - hero_compute#83 -- multi-node connectivity uses explorer_rpc.sock - hero_proxy#19 -- hero_proxy forwards to hero_router, which must handle all socket types
mahmoud self-assigned this 2026-04-09 10:58:48 +00:00
mahmoud added this to the ACTIVE project 2026-04-09 10:58:50 +00:00
mahmoud added this to the now milestone 2026-04-09 10:58:53 +00:00
Sign in to join this conversation.
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#28
No description provided.