High-performance, ultra-hardened dynamic reverse proxy and API routing service written in Rust and backed by Redis / Dragonfly.
Ruxy is a lightweight, cloud-native HTTP reverse proxy designed for dynamic URL routing, origin obfuscation, and seamless traffic redirection without service restarts.
When public traffic hits /:key (e.g., https://proxy.example.com/automation-webhook), Ruxy resolves route:<key> in Redis and streams the request directly to the upstream destination while keeping backend infrastructure completely hidden.
- Blazing Fast & Low Footprint: Built with Axum, Tokio, and
ConnectionManagermultiplexing over Redis/Dragonfly. - Dynamic Real-Time Routing: Update backend target routes instantaneously via Admin REST API or the Web Dashboard.
- Leptos Web Admin Dashboard: Beautiful, responsive WebAssembly single-page application for visual route management.
- Header Sanitization & Origin Protection:
- Automatically strips hop-by-hop headers (
connection,keep-alive,transfer-encoding, etc.). - Removes identifiable origin headers (
Server,Via,X-Powered-By). - Rewrites upstream redirects back to the proxy hostname.
- Automatically strips hop-by-hop headers (
- Interactive OpenAPI 3.0 & Swagger UI: Built-in interactive documentation at
/swagger-ui/. - Production-Hardened Container: Built from
scratch(0 byte OS attack surface, non-root usernobody:nobody, no shell/terminal, read-only rootfs).
Ruxy includes a modern, high-performance WebAssembly Single Page Application (SPA) built with Leptos 0.6 and leptos_router for visual route management.
- Password Authentication: Sign in using your
ADMIN_PASSWORD(orADMIN_TOKEN). Tokens are securely stored in browserLocalStoragewith automatic session invalidation on401 Unauthorized. - Route Explorer:
- Real-time search filter by route key or target URL.
- Configurable pagination (25, 50, 100 items per page).
- Route CRUD Operations:
- Add new dynamic route mappings with live URL validation.
- Edit existing destination target URLs.
- Instant route deletion with confirmation prompts.
- Modern Dark UI: Designed with glassmorphism, responsive cards, and clean typography.
The Ruxy client is now bundled directly into the Axum backend! When you run the Docker container, the WebAssembly application is served automatically.
- Start the application via Docker Compose (see Quick Start below).
- Open
http://localhost:7654/admin/ui/in your browser. - Enter your configured
ADMIN_PASSWORD(orADMIN_TOKEN). - Click Sign In to access and manage your routes.
(Note: If you are doing local frontend development, you can still run trunk serve inside the client/ directory for hot-reloading.)
[ Client ]
β
βΌ (HTTP/HTTPS)
[ Ruxy Proxy (Axum / Tokio) ]
β
ββββΊ 1. Check Redis Cache / Route Store (`route:<key>`)
β
ββββΊ 2. Strip sensitive origin headers & hop-by-hop metadata
β
βΌ 3. Stream request & forward response
[ Hidden Upstream / Origin Service ]
- Docker and Docker Compose
- (Optional for local dev) Rust toolchain (1.80+) and Redis
Copy the example environment file:
cp .env.example .envConfigure your .env variables:
RUST_LOG=info
PORT=7654
REDIS_URL=redis://:proxysecret@redis:6379
ADMIN_TOKEN=change-me-super-secret-token
ADMIN_PASSWORD=change-me-super-secret-password
REDIS_PASSWORD=proxysecret
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/TXXXXX/BXXXXX/XXXXXXXXXXXXdocker compose up -d --buildThe service will start on http://localhost:7654 with:
- Web Admin Dashboard:
http://localhost:7654/admin/ui/ - API / Proxy Service:
http://localhost:7654 - Swagger Documentation:
http://localhost:7654/swagger-ui/ - Health Check:
http://localhost:7654/health
Ruxy provides an interactive Swagger UI out of the box for testing and exploring API endpoints:
- Swagger UI Interface:
http://localhost:7654/swagger-ui/ - Raw OpenAPI 3.0 JSON Spec:
http://localhost:7654/api-docs/openapi.json
- Open
http://localhost:7654/swagger-ui/in your browser. - Click the Authorize π button at the top right.
- In the
api_key (apiKey)modal, enter your configuredADMIN_TOKEN(e.g.change-me-super-secret-token). - Click Authorize and then Close.
- You can now execute and test all admin endpoints directly through Swagger UI.
Administrative route endpoints require the x-api-key header matching your configured ADMIN_TOKEN. The login endpoint authenticates using your ADMIN_PASSWORD.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/health |
Service health status | No |
POST |
/admin/login |
Dashboard password login | No |
GET |
/swagger-ui/ |
Interactive Swagger API docs | No |
GET |
/api-docs/openapi.json |
Raw OpenAPI 3.0 specification | No |
POST |
/admin/routes |
Create or update route mapping | Yes (x-api-key) |
GET |
/admin/routes |
List all dynamic route mappings | Yes (x-api-key) |
GET |
/admin/routes/{*key} |
Fetch details of a specific route | Yes (x-api-key) |
DELETE |
/admin/routes/{*key} |
Delete a route mapping | Yes (x-api-key) |
ANY |
/{*key} |
Public proxy handler | No |
POST /admin/routes
Key Format Rules:
keymust be a path identifier or slug (e.g.webhook,payment-api,auth).keycannot contain protocols like://(e.g.https://is rejected with400 Bad Request).value(or aliastarget) must be a valid destination URL starting withhttp://orhttps://.
Headers:
Content-Type: application/json
x-api-key: <ADMIN_TOKEN>Request Body:
{
"key": "webhook",
"value": "https://automation.bdmade.dev/webhook-test"
}(Note: Both "value" and "target" are supported interchangeably in the payload).
Response (200 OK):
{
"success": true,
"message": "route 'webhook' saved"
}GET /admin/routes
Headers:
x-api-key: <ADMIN_TOKEN>Response (200 OK):
{
"data": [
{
"key": "payment-api",
"value": "https://api.payment.onboarding.bdmade.dev"
},
{
"key": "webhook-test",
"value": "https://yepin.app.n8n.cloud/webhook-test"
}
],
"message": "Successfully data fetched",
"status": 200
}GET /admin/routes/{*key}
Fetch a specific route mapping by its key (e.g. /admin/routes/webhook-test).
Headers:
x-api-key: <ADMIN_TOKEN>Response (200 OK):
{
"data": {
"key": "webhook-test",
"value": "https://yepin.app.n8n.cloud/webhook-test"
},
"message": "Successfully data fetched",
"status": 200
}DELETE /admin/routes/{*key}
Delete a route mapping by its key (e.g. /admin/routes/webhook-test).
Headers:
x-api-key: <ADMIN_TOKEN>Response (200 OK):
{
"success": true,
"message": "route 'webhook-test' deleted"
}scratchBase Image: Built using a multi-stage Dockerfile where the final image contains only the statically-linked binary and CA certificates.- No Shell / Terminal Access: Attackers cannot execute arbitrary commands (
sh,bash,wget,curldo not exist). - Non-Root Execution: Runs under UID
65534:65534(nobody:nobody). - Read-Only Root Filesystem:
read_only: trueenabled in Docker Compose with drop-all capabilities (cap_drop: [ALL]) andno-new-privileges: true.
Ensure Redis is running, then execute:
# Run code formatter check
cargo fmt -- --check
# Run linter
cargo clippy -- -D warnings
# Run test suite
cargo testRuxy is engineered from the ground up for extreme concurrency and low-latency throughput. Understanding how it handles massive request volumes and how to scale it horizontally across distributed clusters ensures seamless production operations under heavy load (e.g. 50kβ500k+ requests/sec).
[ Cloudflare / AWS CloudFront / Edge CDN ]
β
[ Anycast / Layer 4 Load Balancer ]
(AWS NLB / HAProxy)
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
βΌ βΌ βΌ
[ Ruxy Replica #1 ] [ Ruxy Replica #2 ] [ Ruxy Replica #N ]
(Tokio Event Loop) (Tokio Event Loop) (Tokio Event Loop)
(In-Memory L1 Cache) (In-Memory L1 Cache) (In-Memory L1 Cache)
β β β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
β
[ Redis / Dragonfly Cluster ]
(Route Store & Rate Limits)
β
[ Upstream Origin Backends ]
- Asynchronous Non-Blocking I/O (Tokio Runtime): Each incoming request is scheduled onto lightweight Tokio green threads (tasks) across available CPU cores without spawning heavy OS threads.
- Connection Pooling & HTTP Keep-Alive: Upstream backend connections are managed by connection pools in
reqwest, reusing existing TCP sockets and eliminating TLS/TCP handshake latency per request. - Multiplexed Redis Client: Built with Redis
ConnectionManagerto enable pipelined and multiplexed asynchronous queries across threads without connection contention. - Zero-Cost Abstraction & Predictable Memory: Minimal memory allocations per request ensure consistent sub-millisecond p99 latency without garbage collection pauses.
Because Ruxy is 100% stateless (all route data and shared states reside in Redis), scaling capacity is straightforward:
- Multi-Replica Deployment: Run multiple container instances behind a Layer 4 (e.g., AWS NLB, HAProxy) or Layer 7 (e.g., Traefik, Envoy, NGINX) load balancer.
- Kubernetes Auto-Scaling: Deploy with a
HorizontalPodAutoscaler(HPA) targeting CPU utilization (e.g., 60β70%) or incoming HTTP connection count. - Redis Clustering / Dragonfly: For millions of route lookups and global rate limiting, pair with a sharded Redis Cluster, Redis Sentinel, or Dragonfly (multi-threaded in-memory store capable of millions of QPS).
For hosts or worker nodes handling 100k+ concurrent connections, tune the host TCP stack (/etc/sysctl.conf):
# Increase maximum open file descriptors
fs.file-max = 2097152
# Expand ephemeral port range for upstream proxying
net.ipv4.ip_local_port_range = 1024 65535
# Increase TCP connection backlog
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 65535
# Enable fast recycling and reuse of TIME_WAIT sockets
net.ipv4.tcp_tw_reuse = 1This project is licensed under the MIT License.