Introduction
Sol RPC Router uses TOML-based configuration files to define backends, routing rules, health checks, and proxy behavior. All configuration is validated on startup to ensure consistency and prevent runtime errors.Configuration File Location
By default, the router loads configuration fromconfig.toml in the current directory. You can specify a custom path using the --config flag:
File Structure
A complete configuration file contains the following sections:Required vs Optional Sections
Required
HTTP server port for incoming RPC requests
Port for Prometheus metrics endpoint
Redis connection URL for rate limiting and caching
Cannot be empty. Example:
redis://127.0.0.1:6379/0Array of backend RPC nodes. At least one backend must be configured.See Backend Configuration for details.
Optional
Proxy behavior settings. Defaults to 30-second timeout if omitted.See Proxy Configuration for details.
Health check settings. Uses default values if omitted.See Health Check Configuration for details.
Method-specific routing overrides. Optional.See Method Routing for details.
Validation Rules
The configuration is validated on startup with the following checks:Configuration file must exist at the specified path
Redis URL must be non-empty
At least one backend must be configured
All backend labels must be unique
All backend weights must be greater than 0
All backend labels must be non-empty
Proxy timeout must be greater than 0
HTTP port and metrics port must be different
Metrics port cannot conflict with WebSocket port (HTTP port + 1)
Method routes must reference existing backend labels
Proxy Settings
Timeout in seconds for upstream backend requestsValidation: Must be greater than 0
Port Configuration
The router uses multiple ports:- HTTP Port: Main RPC endpoint (
port) - WebSocket Port: Automatically set to
port + 1 - Metrics Port: Prometheus metrics (
metrics_port)
Example Configurations
Minimal Configuration
Production Configuration
Next Steps
Backend Configuration
Configure RPC backends with weights and WebSocket support
Health Checks
Set up automatic health monitoring for backends
Rate Limiting
Configure per-API-key rate limits
Method Routing
Route specific RPC methods to designated backends