Quick Start
Get RevenProx running in under 5 minutes.
Step 1: Create Configuration
Create a configuration file proxy.toml:
# System settings
proxy_id = "proxy-1"
log_level = "info"
metrics_enabled = true
[http]
bind_address = "0.0.0.0:8080"
max_connections = 10000
connection_timeout_sec = 300
keepalive_interval_sec = 30
[jwt_verifier]
webhook_url = "http://your-auth-server/verify"
timeout_ms = 5000
retry_attempts = 3
cache_ttl_sec = 300
require_authentication = true
[limits]
max_memory_mb = 1024
max_cpu_percent = 80
max_file_descriptors = 65536
Step 2: Start the Proxy
You should see:
[INFO] Starting HTTP server on 0.0.0.0:8080
[INFO] HTTP server started successfully
[INFO] Thread pool initialized with 8 workers
Step 3: Connect a Client
Using curl
Using JavaScript
const eventSource = new EventSource(
'http://localhost:8080/events/my-topic',
{
headers: {
'Authorization': 'Bearer <your-jwt-token>'
}
}
);
eventSource.onmessage = (event) => {
console.log('Received:', event.data);
};
eventSource.onerror = (error) => {
console.error('SSE Error:', error);
};
Using Python
import sseclient
import requests
url = 'http://localhost:8080/events/my-topic'
headers = {'Authorization': 'Bearer <your-jwt-token>'}
response = requests.get(url, headers=headers, stream=True)
client = sseclient.SSEClient(response)
for event in client.events():
print(f"Received: {event.data}")
Step 4: Set Up JWT Verification
RevenProx verifies JWT tokens by calling your webhook. Your webhook should:
-
Accept POST requests with JSON body:
-
Return a JSON response:
Example Webhook (Node.js)
const express = require('express');
const jwt = require('jsonwebtoken');
const app = express();
app.use(express.json());
app.post('/verify', (req, res) => {
const { jwt: token, topic } = req.body;
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
res.json({
valid: true,
user_id: decoded.sub,
expires_at: decoded.exp
});
} catch (error) {
res.json({
valid: false,
user_id: null,
expires_at: null
});
}
});
app.listen(9000, () => {
console.log('JWT verification webhook running on port 9000');
});
Step 5: Disable Authentication (Development Only)
For development, you can disable JWT authentication:
Warning
Never disable authentication in production!
Testing the Setup
Health Check
Subscribe to Events
# Terminal 1: Subscribe
curl -N "http://localhost:8080/events/test-topic"
# Terminal 2: The proxy will stream any events published to test-topic
Common Issues
Connection Refused
Solution: Ensure the proxy is running and listening on the correct address.
Authentication Failed
Solution: Check that: - Your JWT token is valid - The webhook URL is accessible - The webhook returns the correct response format
Too Many Connections
Solution: Increase max_connections in configuration or check for connection leaks.
Next Steps
- Basic Concepts - Understand how RevenProx works
- Configuration Overview - Full configuration reference
- API Reference - Complete API documentation