mTLS Bridge Service
Internal HTTP-to-mTLS bridge for services that cannot present client certificates directly (for example, Grafana webhooks).
How it works
- Accepts plain HTTP requests inside the Docker network.
- Forwards requests to an upstream base URL.
- Preserves the incoming request path/method/body/query string.
- Presents a client certificate/key pair for mTLS authentication.
Environment variables
TARGET_URL(required): upstream base URL (for examplehttp://node-red:1880).CLIENT_CERT(default/certs/client.crt): client certificate path.CLIENT_KEY(default/certs/client.key): client private key path.UPSTREAM_CA_CERT(optional, alias:CA_CERT): CA bundle path to verify upstream TLS. Usefalse/0/noto disable verification.TIMEOUT(default5): request timeout in seconds.LOG_LEVEL(defaultINFO): Python logging level.HEALTH_ENDPOINT(default/_mtls_bridge/health): local container health endpoint path.ALLOWED_PATHS_FILE(optional): file path containing one allowed endpoint path per line (for example/health). Blank lines and#comments are ignored. If unset, all paths are allowed.MTLS_BRIDGE_BASIC_AUTH_USERS(required for Traefik auth): value fortraefik.http.middlewares.*.basicauth.users(e.g.user:$$apr1$$...).MTLS_BRIDGE_CORS_ALLOW_ORIGIN(defaulthttps://grafana.lan.ddnsgeek.com): origin allowed for browser-based panel actions.
Endpoints
GET /_mtls_bridge/healthreturns200 OKfor container health checks./*proxies requests to${TARGET_URL}/*with method/body/headers/query string preserved (subject to optional allow-list checks).
Examples with TARGET_URL=http://node-red:1880:
https://mtls-bridge.../docker-update-lockouts/clear->http://node-red:1880/docker-update-lockouts/clearhttps://mtls-bridge.../health->http://node-red:1880/healthhttps://mtls-bridge.../uptime-kuma->http://node-red:1880/uptime-kuma
Compose integration
This repository includes monitoring/mtls-bridge/docker-compose.yml:
- No public port exposure.
- Read-only cert mount (
${PROJECT_ROOT}/core/traefik/certs:/certs:ro). - Joined to internal monitoring/traefik networks.
Example test
curl http://mtls-bridge:8080/_mtls_bridge/health
curl -X POST http://mtls-bridge:8080/docker-update-lockouts/clear
Allow-list file example
# one path per line
/docker-update-lockouts/clear
/health
/uptime-kuma
When ALLOWED_PATHS_FILE is set, any path not listed returns 403 Endpoint not allowed.