Description
When an edge has the substrate service enabled, it registers a catch-all HTTP handler via PathPrefix: "/" in services/substrate/components/http/api.go:attach(). This handler intercepts all incoming HTTP requests and attempts to match them against TNS-hosted serviceables (functions/websites).
When no TNS match is found, the handler returns a 500 error:
looking up serviceable failed with: http serviceable lookup failed with: no HTTP match found for method `GET` on `https://127.0.0.1/v1/device/tee/status`
This blocks access to mesh-api routes like GET /v1/device/tee/status, GET /health, and any other routes registered by non-substrate services.
Impact
- TEE attestation status endpoint unreachable on edges with
substrate service
- Dashboard cannot fetch TEE data for affected edges
- Any mesh-api route that the substrate handler doesn't know about is blocked
Root Cause
-
services/substrate/components/http/api.go:attach() registers:
s.Http().LowLevel(&http.LowLevelDefinition{
PathPrefix: "/",
Handler: s.Handler,
})
-
Additionally, pkg/http/basic/routes.go:LowLevel() has a bug -- when PathPrefix is set, it uses def.Path instead of def.PathPrefix:
if len(def.PathPrefix) > 0 {
return s.Router.PathPrefix(def.Path).HandlerFunc(def.Handler) // uses Path, not PathPrefix
}
-
When the substrate handler can't find a TNS match, it returns a 500 error instead of passing the request through to other handlers.
Reproduction
- Create an edge with
substrate in mesh_services
- Start the edge
curl http://127.0.0.1:<port>/v1/device/tee/status returns 500 with serviceable lookup error
- Remove
substrate from services, same curl returns TEE status JSON
Expected Behavior
Mesh-api routes should take priority over the substrate catch-all handler, or the substrate handler should pass unmatched requests through to the next handler.
Affected Files
services/substrate/components/http/api.go (catch-all registration)
services/substrate/components/http/lookup.go (error on no match)
pkg/http/basic/routes.go (LowLevel PathPrefix bug)
Description
When an edge has the
substrateservice enabled, it registers a catch-all HTTP handler viaPathPrefix: "/"inservices/substrate/components/http/api.go:attach(). This handler intercepts all incoming HTTP requests and attempts to match them against TNS-hosted serviceables (functions/websites).When no TNS match is found, the handler returns a 500 error:
This blocks access to mesh-api routes like
GET /v1/device/tee/status,GET /health, and any other routes registered by non-substrate services.Impact
substrateserviceRoot Cause
services/substrate/components/http/api.go:attach()registers:Additionally,
pkg/http/basic/routes.go:LowLevel()has a bug -- whenPathPrefixis set, it usesdef.Pathinstead ofdef.PathPrefix:When the substrate handler can't find a TNS match, it returns a 500 error instead of passing the request through to other handlers.
Reproduction
substrateinmesh_servicescurl http://127.0.0.1:<port>/v1/device/tee/statusreturns 500 with serviceable lookup errorsubstratefrom services, same curl returns TEE status JSONExpected Behavior
Mesh-api routes should take priority over the substrate catch-all handler, or the substrate handler should pass unmatched requests through to the next handler.
Affected Files
services/substrate/components/http/api.go(catch-all registration)services/substrate/components/http/lookup.go(error on no match)pkg/http/basic/routes.go(LowLevel PathPrefix bug)