Managing Routes
Complete guide to creating, editing, and managing routes through the FlexGate Admin UI.
Routes Dashboard
The Routes page is your central hub for managing all API routes in FlexGate.
Accessing Routes
- Login to Admin UI at http://localhost:3000/admin
- Click "Routes" in the left sidebar
- You'll see the routes management dashboard
Dashboard Overview
The routes dashboard displays:
Stats Cards (Top):
- Total Routes
- Active Routes
- Routes with Errors
- Total Traffic (24h)
Routes Table:
- Route ID and Path
- Upstream URL
- Status (Enabled/Disabled)
- Health Status
- Traffic Stats
- Quick Actions
Toolbar:
- Search bar
- Filter options
- Add Route button
- Bulk actions
- Import/Export
Creating a New Route
Method 1: Quick Create
For simple routes, use the quick create form:
- Click "Add Route" button (top right)
- Fill in the essential fields:
- Path:
/api/example - Upstream:
http://backend:8080 - Methods: Select methods (GET, POST, etc.)
- Path:
- Click "Create"
The route is created with default settings and immediately active.
Method 2: Advanced Create
For routes with advanced configuration:
- Click "Add Route" → "Advanced"
- Fill in the comprehensive form with all sections
- Preview the configuration
- Click "Create and Configure"
Route Creation Form
General Settings
Required Fields:
| Field | Description | Example |
|---|---|---|
| Route ID | Unique identifier | api-users-v1 |
| Path | URL path pattern | /api/v1/users/* |
| Upstream | Backend server URL | http://user-service:8080 |
Optional Fields:
| Field | Description | Default |
|---|---|---|
| Methods | HTTP methods | All methods |
| Description | Human-readable desc | Empty |
| Priority | Route matching order | 50 |
| Enabled | Active status | true |
| Tags | Organizational tags | [] |
Path Pattern Helper:
The UI provides a pattern helper with examples:
/exact/path- Exact match/prefix/*- Prefix match/api/*/resource- Wildcard match- Click "Pattern Guide" for regex examples
Upstream Validation:
The form validates upstream URLs:
- ✅
http://backend:8080 - ✅
https://api.example.com - ✅
http://192.168.1.100:3000 - ❌
backend:8080(missing protocol) - ❌
https://(missing host)
Rate Limiting Section
Enable and configure rate limiting:
- Toggle "Enable Rate Limiting"
- Configure settings:
Basic Settings:
- Max Requests:
100 - Time Window:
60000ms (1 minute) - Strategy: Dropdown with options:
- Token Bucket (recommended)
- Fixed Window
- Sliding Window
- Leaky Bucket
Advanced Settings:
- Scope: IP Address, User, API Key, Route
- Key Generator: Custom expression
- Skip Successful Requests: Checkbox
- Skip Failed Requests: Checkbox
Custom Response:
- Status Code:
429 - Message: Custom error message
- Headers: Add X-RateLimit-* headers
Preview Panel:
The UI shows a live preview:
With current settings:
- Users can make 100 requests per minute
- Requests are limited per IP address
- Excess requests return 429 status
- Rate limit resets every 60 secondsHealth Checks Section
Configure upstream health monitoring:
- Toggle "Enable Health Checks"
- Configure:
Health Check URL:
- Default: Same as upstream +
/health - Custom: Enter specific endpoint
- Test button validates endpoint
Timing:
- Interval:
30000ms (30 seconds) - Timeout:
5000ms (5 seconds)
Thresholds:
- Healthy Threshold:
2successes - Unhealthy Threshold:
3failures
Expected Response:
- Status Code:
200 - Contains Text: Optional validation
Status Indicator:
Live health status shows:
- 🟢 Healthy - All checks passing
- 🟡 Degraded - Some checks failing
- 🔴 Unhealthy - Health checks failing
- ⚪ Unknown - No health data yet
Circuit Breaker Section
Protect against cascading failures:
- Toggle "Enable Circuit Breaker"
- Configure:
Thresholds:
- Error Threshold:
50% (0-100) - Volume Threshold:
10requests minimum - Timeout:
30000ms (open duration) - Reset Timeout:
60000ms (recovery attempt)
Error Conditions:
- Status Codes: 500, 502, 503, 504
- Network Errors: ECONNREFUSED, ETIMEDOUT
Fallback Response:
- Status Code:
503 - Response Body: JSON or text
- Custom Headers: Optional
Circuit State Visualization:
The UI shows current state:
[CLOSED] ──error threshold──> [OPEN]
▲ │
│ │
└───successful requests────[HALF_OPEN]Headers Section
Add, remove, or modify headers:
Request Headers:
| Action | Name | Value | Direction |
|---|---|---|---|
| Add | X-API-Version | v1 | Request |
| Add | X-Request-ID | ${requestId} | Request |
| Remove | X-Internal-Token | - | Request |
Click "+ Add Header" to add more.
Response Headers:
| Action | Name | Value | Direction |
|---|---|---|---|
| Add | X-Powered-By | FlexGate | Response |
| Remove | Server | - | Response |
Dynamic Values:
Use variables in header values:
${requestId}- Unique request ID${timestamp}- Current timestamp${clientIp}- Client IP address${route}- Route ID${method}- HTTP method${responseTime}- Response time in ms
Authentication Section
Secure your route:
Type Selection:
- None (public route)
- JWT
- API Key
- OAuth 2.0
- Custom
JWT Configuration:
- Secret: Use environment variable
- Algorithm: HS256, RS256, etc.
- Issuer Validation: Enable/disable
- Audience Validation: Enable/disable
- Expiration Check: Enable/disable
API Key Configuration:
- Header Name:
X-API-Key - Query Parameter:
api_key - Validation Source: Database or config
Test Authentication:
Click "Test Auth" to validate:
- Paste a test token/key
- Click "Validate"
- See validation result
Caching Section
Enable response caching:
- Toggle "Enable Caching"
- Configure:
Cache Settings:
- TTL:
300000ms (5 minutes) - Storage: Redis or Memory
- Max Size:
10MBper cache entry
Cache Key:
Select components to vary cache by:
- ☑ HTTP Method
- ☑ Path
- ☑ Query Parameters
- ☐ Headers (select specific)
- ☐ Body (hash)
Cache Control:
- ☑ Respect Cache-Control headers
- ☑ Respect Vary headers
- Cache only status codes: 200, 301, 404
Cache Statistics:
View cache performance:
- Hit Rate: 87%
- Hits: 1,234
- Misses: 182
- Size: 45MB
Timeouts Section
Configure connection and request timeouts:
Timeout Settings:
- Connect Timeout:
5000ms - Request Timeout:
30000ms - Keep-Alive Timeout:
60000ms
Visual Timeout Guide:
Client ─[5s]─> FlexGate ─[5s]─> Upstream
connect timeout
FlexGate ──────[30s]──────> Upstream
request timeoutRetry Logic Section
Automatically retry failed requests:
- Toggle "Enable Retry"
- Configure:
Retry Settings:
- Max Attempts:
3 - Backoff Strategy: Exponential
- Initial Delay:
100ms - Max Delay:
10000ms - Multiplier:
2
Retry Conditions:
Retry on these status codes:
- ☑ 502 (Bad Gateway)
- ☑ 503 (Service Unavailable)
- ☑ 504 (Gateway Timeout)
Do NOT retry on:
- ☑ 400 (Bad Request)
- ☑ 401 (Unauthorized)
- ☑ 404 (Not Found)
Retry Visualization:
Attempt 1: 100ms delay
Attempt 2: 200ms delay (×2)
Attempt 3: 400ms delay (×2)Form Validation
The form validates input in real-time:
Validation States:
- 🟢 Valid - Green checkmark
- 🔴 Invalid - Red error message
- 🟡 Warning - Yellow warning icon
Common Validation Errors:
- "Path must start with /"
- "Upstream URL is invalid"
- "Rate limit max must be > 0"
- "Timeout must be between 1000 and 300000"
Configuration Preview
Before saving, preview your configuration:
- Click "Preview" tab
- See YAML representation
- Validate configuration
- Copy to clipboard
id: api-users-v1
path: /api/v1/users/*
upstream: http://user-service:8080
methods: [GET, POST]
enabled: true
rateLimit:
enabled: true
max: 100
windowMs: 60000
# ... full configurationSaving the Route
Save Options:
- Save - Create/update route
- Save & Test - Save and open test panel
- Save Draft - Save as disabled route
- Schedule - Schedule activation time
After Saving:
- Success notification appears
- Redirected to route details
- Route appears in routes list
- HAProxy configuration updated
Editing Existing Routes
Quick Edit
For simple changes:
- Hover over route in table
- Click pencil icon (edit)
- Modify fields in inline editor
- Click "Save" or press Enter
- Changes applied immediately
Quick Editable Fields:
- Enabled/Disabled toggle
- Upstream URL
- Priority
Full Edit
For comprehensive changes:
- Click route row in table
- Full edit form opens
- Modify any section
- Click "Save Changes"
Edit History:
The UI shows change history:
- Who made changes
- When changes were made
- What was changed (diff view)
- Rollback option
Bulk Editing
Edit multiple routes at once:
- Select routes (checkboxes)
- Click "Bulk Actions"
- Choose action:
- Enable/Disable
- Change priority
- Add tags
- Update headers
- Export
Testing Routes
Built-in Test Panel
Test routes without leaving the Admin UI:
- Open route details
- Click "Test" tab
- Configure test request:
Request Configuration:
- Method: GET, POST, PUT, DELETE
- Path:
/api/v1/users/123 - Headers: Add custom headers
- Body: JSON, XML, or form data
- Auth: Include token/key
Send Request:
Click "Send" to test:
Response Display:
- Status code with color coding
- Response headers
- Response body (formatted)
- Response time
- Size
Response Tabs:
- Pretty (formatted JSON/XML)
- Raw (original response)
- Headers (all headers)
- Timeline (request lifecycle)
Save Test:
Save test for reuse:
- Name the test
- Save request configuration
- Run anytime with one click
Request History
View recent test requests:
- Last 10 tests
- Status and response time
- Click to view details
- Rerun previous tests
Monitoring Routes
Route Metrics
Each route has detailed metrics:
Traffic Metrics:
- Requests per second (live)
- Total requests (24h, 7d, 30d)
- Success rate (2xx/total)
- Error rate (4xx, 5xx)
Performance Metrics:
- Average response time
- P50, P95, P99 latency
- Slowest requests
- Fastest requests
Charts:
- Request rate over time (line chart)
- Response time distribution (histogram)
- Status code breakdown (pie chart)
- Error rate trend (area chart)
Live Traffic View
Watch requests in real-time:
- Click "Live Traffic" button
- See streaming requests:
10:30:15 GET /api/users/123 → 200 (45ms)
10:30:16 POST /api/users → 201 (123ms)
10:30:17 GET /api/users → 200 (12ms)Filters:
- Filter by status code
- Filter by response time
- Filter by client IP
- Full-text search
Alerts
Set up alerts for route issues:
Alert Types:
- High error rate (>5%)
- Slow response time (>1000ms)
- Circuit breaker opened
- Health check failing
- Rate limit frequently hit
Notification Channels:
- Slack
- Webhook
- SMS (via integration)
Route Organization
Tags
Organize routes with tags:
Adding Tags:
- Edit route
- Tags section
- Type tag name
- Press Enter
- Save route
Common Tags:
productionstagingpublicinternalv1,v2deprecated
Filter by Tags:
- Click tag in route list
- See all routes with that tag
- Combine multiple tags
Folders/Groups
Group related routes:
- Click "Create Group"
- Name the group (e.g., "User API")
- Drag routes into group
- Collapse/expand groups
Group Actions:
- Enable/disable all routes
- Export group
- Clone group
- Delete group
Search & Filters
Powerful search capabilities:
Quick Search:
- Type in search bar
- Searches path, upstream, ID, description
- Real-time results
Advanced Filters:
- Status: Enabled, Disabled, All
- Health: Healthy, Unhealthy, Unknown
- Tags: Any, All, None
- Traffic: High, Medium, Low, None
- Errors: Has errors, No errors
Saved Filters:
- Save filter combinations
- Quick access from dropdown
- Share filters with team
Import & Export
Export Routes
Export routes for backup or migration:
Export Options:
- Click "Export" button
- Select routes (or all)
- Choose format:
- YAML
- JSON
- CSV (limited fields)
- Download file
Example Export (YAML):
routes:
- id: api-users-v1
path: /api/v1/users/*
upstream: http://user-service:8080
# ... full configuration
- id: api-orders-v1
# ...Import Routes
Import routes from file:
Import Process:
- Click "Import" button
- Upload file (YAML or JSON)
- Review preview:
- New routes (green)
- Updated routes (yellow)
- Conflicts (red)
- Resolve conflicts:
- Keep existing
- Overwrite
- Create new (rename)
- Click "Import"
Validation:
The import validates:
- ✅ Valid YAML/JSON syntax
- ✅ Required fields present
- ✅ Valid configuration values
- ✅ No ID conflicts
- ✅ Upstream URLs reachable
Dry Run:
Test import without applying:
- Shows what would change
- Validates configuration
- No actual changes made
Clone Route
Create a copy of existing route:
- Click route menu icon (⋮)
- Select "Clone"
- New route created with:
- Same configuration
- New ID (with
-copysuffix) - Disabled by default
- Edit and enable when ready
Use Cases:
- Create staging version of production route
- Test configuration changes safely
- Create similar routes quickly
Delete Routes
Remove routes safely:
Delete Single Route:
- Click route menu icon (⋮)
- Select "Delete"
- Confirm deletion
- Route removed immediately
Soft Delete:
Routes are soft-deleted by default:
- Marked as deleted
- Hidden from list
- Can be restored for 30 days
- Permanently deleted after 30 days
Restore Deleted Route:
- Click "Show Deleted" toggle
- Find deleted route
- Click "Restore"
- Route reactivated
Bulk Delete:
- Select multiple routes
- Click "Bulk Actions" → "Delete"
- Confirm deletion
- All selected routes deleted
Troubleshooting
Route Not Receiving Traffic
Checklist:
- ✅ Route is enabled
- ✅ Path pattern matches requests
- ✅ Priority is appropriate
- ✅ No higher-priority route intercepting
- ✅ HAProxy configuration updated
Debug Steps:
- Check route in Admin UI
- View "Live Traffic" - any requests?
- Check HAProxy logs
- Test with curl
- Enable debug logging
502 Bad Gateway Errors
Common Causes:
- Upstream server down
- Upstream unreachable
- DNS resolution failure
- Connection timeout too low
Solutions:
- Check upstream health status
- Test upstream directly:
curl http://upstream:8080 - Increase connect timeout
- Check network connectivity
- Review upstream logs
Rate Limiting Not Working
Checklist:
- ✅ Rate limiting enabled on route
- ✅ Redis connection healthy
- ✅ Correct scope configured
- ✅ TTL not too high
Debug:
- Check Redis:
redis-cli KEYS "rate-limit:*" - View rate limit counters
- Test with curl loop
- Check Admin UI metrics
Circuit Breaker Stuck Open
When This Happens:
- Route returns 503 immediately
- No requests reach upstream
- "Circuit open" in logs
Solutions:
- Check upstream health
- Wait for reset timeout
- Manually reset circuit breaker
- Adjust thresholds if too sensitive
Manual Reset:
- Route details → Circuit Breaker section
- Click "Reset Circuit Breaker"
- Confirm reset
- Monitor status
Best Practices
Route Naming
Good route IDs:
- ✅
api-users-v1 - ✅
internal-auth-service - ✅
public-blog-posts
Poor route IDs:
- ❌
route1 - ❌
test - ❌
my-route-123-temp
Path Organization
Organize paths logically:
/api/v1/users/*
/api/v1/posts/*
/api/v1/comments/*
/api/v2/users/* ← New versionPriority Strategy
Assign priorities systematically:
- 100-199: Exact matches
- 50-99: Prefix matches
- 0-49: Wildcard/catch-all
Health Checks
Always enable health checks for:
- Production routes
- External upstreams
- Critical services
Skip for:
- Third-party APIs (use rate limit)
- Static content CDNs
Documentation
Use description field:
description: |
User management API v1
Owner: Platform Team
SLA: 99.9% uptime
Contact: platform@example.comKeyboard Shortcuts
Speed up route management:
| Shortcut | Action |
|---|---|
N | New route |
E | Edit selected route |
D | Delete selected route |
T | Test selected route |
Cmd/Ctrl + S | Save current form |
Cmd/Ctrl + K | Search routes |
/ | Focus search |
↑ ↓ | Navigate routes |
Space | Select route |
Esc | Close modal |
Next Steps
- Monitoring Routes - Deep dive into metrics
- Settings - Configure global defaults
- API Reference - Programmatic access
Questions? Visit our GitHub Discussions.