Router Proxy
A reverse proxy application that provides unified access to multiple network routers through subdomains of a single external domain, complete with automatically generated documentation.
Purpose
Router Proxy simplifies management and access to multiple routers in a network by:
- Reverse proxying each router to a subdomain of your external domain (e.g.,
gateway.example.com,ap1.example.com) - Generating a documentation site that lists all configured routers with their details (model, firmware, description)
This is particularly useful for managing networks with multiple access points or distributed routing equipment.
Note: Configuration changes require restarting the application.
Setup
1. Configuration File
Create a configuration file with your external domain and routers. This file needs to be mounted at /config/config.yml inside the container:
external_domain: router.example.com
external_protocol: https
app_name: "Router Proxy"
routers:
- name: "Gateway"
subdomain: gateway
url: "http://192.168.0.1"
description: "The main router that connects to the internet"
model: Netgear R7000
firmware: OpenWRT
- name: "AP-1"
subdomain: ap1
url: "http://192.168.0.35"
description: "The primary access point"
model: Netgear R7000
firmware: Stock
Configuration Fields:
external_domain: The domain under which all routers will be accessible (e.g.,router.example.com)external_protocol: Protocol for generated URLs (httporhttps)app_name: Display name for the applicationrouters: List of routers to proxyname: Display name for the routersubdomain: Subdomain for this router (will be accessible at{subdomain}.{external_domain})url: Internal URL to proxy requests to (e.g., internal IP address)description: Human-readable descriptionmodel: Router model namefirmware: Firmware version or type
2. Docker Deployment
Using Docker Compose:
docker-compose up -d
The application runs on port 8080 by default. Two internal services are also available:
- Port 8081: Documentation site (MkDocs)
Environment variable override:
CONFIG_FILE_LOCATION=/path/to/config.yml
How Templates Work
Templates are Jinja2 files in app/templates/ that are rendered with configuration data to generate runtime files.
Template System
The TemplateService provides these template variables:
port: Nginx port (default 8080)list_port: Documentation site port (default 8081)external_domain: From configapp_name: From configaccessible_external_url: Full URL (protocol + domain)routers: List of all routers with computed domains and URLsgenerated_time: Timestamp when templates were rendered
Built-in Templates
nginx.conf (app/templates/nginx.conf)
- Generates Nginx reverse proxy configuration
- Creates a server block for the root domain (proxies to documentation)
- Creates a server block for each router subdomain with its corresponding proxy rule
mkdocs.yml (app/templates/mkdocs.yml)
- Generates MkDocs site configuration
- Sets site name, URL, and theme
index.md (app/templates/index.md)
- Generates the documentation homepage
- Lists all configured routers with links, descriptions, model, and firmware details
- Includes a timestamp of generation
Architecture
Router Proxy consists of four main services:
graph TD
B["ConfigService<br/>- Load config<br/>- Parse YAML<br/>- Compute URLs"]
C["TemplateService<br/>- Render Jinja2<br/>- Provide variables<br/>- Write files"]
D["NginxService<br/>- Render config<br/>- Start nginx"]
E["MkDocsService<br/>- Render site<br/>- Serve on 8081"]
F["Nginx<br/>Port 8080"]
G["MkDocs<br/>Port 8081"]
H["External Routers<br/>via subdomains"]
B --> C
C --> D
C --> E
D --> F
E --> G
F --> G
F --> H