This package implements a docker dynamic upstreams module for Caddy.
Requires Caddy 2+.
This module requires the Docker Labels to provide the necessary information.
com.caddyserver.http.enable
should betrue
com.caddyserver.http.upstream.port
specify the port
As well as the labels corresponding to the matcher.
Label | Matcher |
---|---|
com.caddyserver.http.matchers.protocol |
protocol |
com.caddyserver.http.matchers.host |
host |
com.caddyserver.http.matchers.method |
method |
com.caddyserver.http.matchers.path |
path |
com.caddyserver.http.matchers.query |
query |
com.caddyserver.http.matchers.expression |
expression |
Here is a docker-compose.yml example with vaultwarden.
vaultwarden:
image: vaultwarden/server:${VAULTWARDEN_VERSION:-latest}
restart: unless-stopped
volumes:
- ${VAULTWARDEN_ROOT}:/data
labels:
com.caddyserver.http.enable: true
com.caddyserver.http.upstream.port: 80
com.caddyserver.http.matchers.host: vaultwarden.example.com
environment:
DOMAIN: https://vaultwarden.example.com
List all your domain or use On-Demand TLS.
app1.example.com,
app2.example.com,
app3.example.com {
reverse_proxy {
dynamic docker
}
}