Routes Configuration
Routes map hostnames to container images.
Configuration
[routes]
"app.mydomain.com" = { image = "myapp:latest" }
"api.mydomain.com" = { image = "myapi:v2.1.0" }
"admin.mydomain.com" = { image = "admin-panel:v1.0.0" }
Syntax
[routes]
"<domain>" = { image = "<image>:<tag>" }
| Component | Description |
|---|---|
domain |
Public, fully qualified domain name |
image |
Full container image reference, including tag |
https |
Optional; add false for HTTP-only routes |
Legacy http://... route keys are still read for backward compatibility and rewritten on the next save.
Route Types
HTTPS Routes (Default)
Standard routes expect HTTPS traffic (terminated by Cloudflare or similar):
[routes]
"app.mydomain.com" = { image = "myapp:latest" }
Route domains must be plain hostnames. Gordon rejects http:// and https:// prefixes, .local and .internal suffixes, localhost names, and IP literals.
Development Routes
For local testing, use a hostname you can resolve yourself:
[routes]
"dev-app.example.com" = { image = "internal-app:latest", https = false }
Version Strategies
Latest Tag
Always deploy the most recent push:
[routes]
"app.mydomain.com" = { image = "myapp:latest" }
Pinned Version
Deploy a specific version:
[routes]
"app.mydomain.com" = { image = "myapp:v2.1.0" }
Update the config to deploy a new version:
[routes]
"app.mydomain.com" = { image = "myapp:v2.2.0" } # Changed
Semantic Versioning
Use different routes for different versions:
[routes]
"app.mydomain.com" = { image = "myapp:v2.1.0" } # Production
"staging.mydomain.com" = { image = "myapp:staging" } # Staging
"canary.mydomain.com" = { image = "myapp:canary" } # Canary
Multiple Routes
Same Image, Different Domains
[routes]
"app.mydomain.com" = { image = "myapp:latest" }
"www.mydomain.com" = { image = "myapp:latest" }
"mydomain.com" = { image = "myapp:latest" }
Multiple Services
[routes]
"app.mydomain.com" = { image = "frontend:latest" }
"api.mydomain.com" = { image = "backend:v2.1.0" }
"docs.mydomain.com" = { image = "documentation:latest" }
"status.mydomain.com" = { image = "status-page:v1.0.0" }
How Routing Works
- Request arrives for
app.mydomain.com - Gordon looks up the route in configuration
- Finds running container for
myapp:latest - Proxies request to container's exposed port
- Returns response to client
Client ─> Gordon Proxy ─> Container
(port 80) (exposed port)
Deployment Flow
When you push an image:
docker push registry.mydomain.com/myapp:latest
- Gordon receives the image
- Checks routes for any that use
myapp:latest - Deploys new container for each matching route
- Updates proxy to route traffic to new container
- Stops old container
Route Changes
Route changes in the config file are hot-reloaded automatically:
- Edit
[routes]ingordon.toml - Save the file
- Gordon reloads the updated routes and proxy config
Legacy http://... route keys are still read here for backward compatibility and rewritten the next time Gordon saves the config.
You can still manage routes with the API or CLI if you prefer live mutations:
gordon routes add newapp.mydomain.com newapp:latest
gordon routes add app.mydomain.com myapp:v2.2.0
gordon routes remove oldapp.mydomain.com
Examples
Development Setup
[routes]
"dev-app.example.com" = { image = "myapp:latest" }
"dev-api.example.com" = { image = "myapi:latest" }
Add to /etc/hosts:
127.0.0.1 dev-app.example.com dev-api.example.com registry.example.com
Production Setup
[routes]
"app.company.com" = { image = "company-app:v2.1.0" }
"api.company.com" = { image = "company-api:v1.5.2" }
"admin.company.com" = { image = "admin-panel:v1.0.1" }
"docs.company.com" = { image = "company-docs:latest" }
Multi-Tenant SaaS
[routes]
# Platform services
"app.saas-platform.com" = { image = "saas-frontend:v2.1.0" }
"api.saas-platform.com" = { image = "saas-api:v3.2.1" }
# Customer subdomains
"acme.saas-platform.com" = { image = "saas-app:v2.1.0" }
"beta.saas-platform.com" = { image = "saas-app:v2.1.0" }
# Customer custom domains
"portal.acme-corp.com" = { image = "saas-app:v2.1.0" }
External Services
For non-containerized services (databases, legacy apps, etc.), see External Routes.