Files
universe/deploy/lux-system/rpc-root-rewrite.md
T

2.1 KiB

Bare-hostname RPC — https://api.<brand>.network in MetaMask

A user should be able to paste https://api.lux.network into MetaMask and have it work. That is what these two objects do together:

IngressRoute lux-mainnet/api-brand-root-mainnet
  Host(`api.<brand>.network`) && Path(`/`)   priority 10000
  -> middleware rpc-rewrite-<brand>          -> svc api-gateway-gateway

Middleware lux-system/rpc-rewrite-lux        replacePath: /v1/chain/C/rpc
Middleware lux-system/rpc-rewrite-hanzo      replacePath: /v1/chain/hanzo/rpc
Middleware lux-mainnet/zoo-rpc-rewrite       replacePath: /v1/chain/zoo/rpc

It was broken for ~57 days, and the failure was invisible

All three rewrote to the RETIRED /v1/chain/... prefix. luxd serves /v1/chain/... now, so the root route rewrote every request onto a path the gateway does not have and answered 404 page not found — Traefik's default body, which reads like "no such host/route" rather than "your rewrite target is wrong". Meanwhile the explicit /v1/chain/C/rpc kept working, so nothing looked broken unless you tried the bare hostname the way a wallet does.

Verified after the fix (2026-08-06), bare hosts, no path: api.lux.network eth_chainId 0x17871 (96369) net_version 96369 api.zoo.network 0x30e08 (200200) api.hanzo.network 0x9063 (36963) api.pars.network 0x78d65 (494949) and a full wallet handshake on api.lux.network: eth_chainId, net_version, eth_blockNumber, eth_gasPrice, eth_getBalance all 200 with real values.

⛔ Do NOT add a / endpoint to the gateway's own krakend config to achieve this. That was tried and reverted: it duplicates the mechanism, and two ways to route the same request is exactly what this estate forbids. The rewrite middleware is the one way.

⚠ api.spc.network returns nothing on the bare host — it has a brand-root route but no rewrite middleware of its own. Left alone rather than guessed at.

⚠ api.lux.network/v1/health answering 503 is NOT this: lux-mainnet runs with --dex-validator, so its health check includes a D-Chain the public luxd image does not carry. Zoo, which does not, answers 200. See the luxd-health note.