POST /
Proxy JSON-RPC requests to backend Solana RPC nodes. The router authenticates requests via API key, selects a healthy backend using weighted load balancing or method-based routing, and forwards the request.Authentication
All proxy requests require an API key passed as a query parameter:Request
JSON-RPC version (must be
"2.0")Request identifier
Solana RPC method name (e.g.,
getAccountInfo, getSlot, sendTransaction)Method-specific parameters
Response
The response format matches the Solana JSON-RPC specification. Successful backend responses are proxied transparently:JSON-RPC version (
"2.0")Request identifier (matches request)
Method-specific result data from the backend
Error object (only present if backend returned an error)
Error Responses
Returned when:
- No
api-keyquery parameter provided - Invalid API key
- API key is inactive (
active=falsein Redis)
"Unauthorized"Returned when the API key exceeds its configured rate limit (RPS).Response body:
"Rate limit exceeded"Returned when:
- Redis connection error during key validation
- Invalid backend URI configuration
"Internal Server Error" or "Invalid backend configuration"Returned when the backend request fails (network error, invalid response, etc.).Response body:
"Proxy error: {error_details}"Returned when no healthy backends are available to handle the request.Response body:
"No healthy backends available"Returned when the backend request exceeds the configured timeout (default 30s).Response body:
"Upstream request timed out after {timeout}s"Backend Selection
The router selects backends using this priority:- Method-based routing: If the
methodfield matches a configured route (e.g.,getSlot -> mainnet-primary), that backend is used if healthy - Weighted load balancing: Randomly selects from healthy backends using configured weights
- Fallback: Returns 503 if no healthy backends are available
Request Examples
Response Examples
POST /*path
Proxy JSON-RPC requests with a custom path. This endpoint forwards requests to{backend_url}{path}?{query_params} while stripping the api-key parameter.
Path Parameters
Custom path to append to the backend URL (e.g.,
/v1/mainnet)Authentication
Same asPOST / - requires ?api-key=YOUR_API_KEY query parameter.
Request/Response
Identical toPOST / endpoint. The only difference is the path forwarding behavior.
Path Handling
The router constructs the backend URL as:- Request:
POST /v1/mainnet?api-key=abc123&commitment=finalized - Backend:
{backend_url}/v1/mainnet?commitment=finalized
Security: The
api-key query parameter is automatically stripped before forwarding requests to backends. This ensures backend nodes never see client API keys, and request logs on backend nodes don’t contain sensitive credentials.Example
Custom Path
Rate Limiting
BothPOST / and POST /*path share the same rate limit counter per API key. Rate limits are enforced atomically in Redis using a Lua script:
- Increment
rate_limit:{api_key}counter - Set 1-second TTL if this is the first request in the window
- Compare count against the key’s configured
rate_limit - Return 429 if limit exceeded
Timeout Behavior
Backend requests timeout after the configuredproxy.timeout_secs (default 30s). When a timeout occurs:
- Status:
504 Gateway Timeout - Response:
"Upstream request timed out after {timeout}s" - Metrics: Request is logged with backend label and timeout status
Host Header
The router automatically updates theHost header to match the selected backend, ensuring proper routing through CDNs and reverse proxies.