Skip to main content

Overview

Secure API for managing backends without restart.

Authentication

Add X-API-Key header when API key is configured:
curl -H "X-API-Key: YOUR_KEY" http://localhost:8080/admin/backends

Endpoints

MethodEndpointDescription
GET/admin/backendsList all backends
POST/admin/backendsAdd backend
DELETE/admin/backendsRemove backend
PUT/admin/backends/weightUpdate weight
POST/admin/backends/drainStart draining
POST/admin/backends/undrainStop draining
GET/admin/healthAPI health check

Examples

# List backends
curl -H "X-API-Key: YOUR_KEY" http://localhost:8080/admin/backends

# Add backend
curl -X POST -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"address":"10.0.0.5:8080","weight":100}' \
  http://localhost:8080/admin/backends

# Update weight
curl -X PUT -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"address":"10.0.0.5:8080","weight":150}' \
  http://localhost:8080/admin/backends/weight

# Drain for maintenance
curl -X POST -H "X-API-Key: YOUR_KEY" \
  -d '{"address":"10.0.0.5:8080"}' \
  http://localhost:8080/admin/backends/drain

Response Format

{
  "success": true,
  "message": "Backends listed",
  "data": [
    {
      "address": "10.0.0.1:8080",
      "weight": 100,
      "healthy": true,
      "active_connections": 5,
      "total_requests": 1234
    }
  ]
}

Error Response

{
  "success": false,
  "message": "Backend not found"
}