proxyctl
Workstation
proxyctl drives a Traefik reverse proxy on ports 80 and 443 of your computer. It serves every local project in HTTPS under *.localhost, whether the project runs in Docker or directly on the host (a Vite or Symfony CLI dev server, for example). Certificates come from mkcert. It belongs to the workstation setup.
Domains end in .localhost, which systemd-resolved resolves to 127.0.0.1 without any DNS or /etc/hosts entry. Port 80 redirects to HTTPS. The Traefik dashboard is served on https://traefik.localhost/.
Messages are written in French.
Install
proxyctl needs Go to build, and Docker with Compose v2 and mkcert to run.
sudo apt install mkcert && mkcert -install
make -C proxyctl install
make install builds the binary and copies it to ~/.local/bin/proxyctl. make install PREFIX=/usr/local/bin chooses another folder. The make target says so when the folder is not in your PATH. make -C proxyctl uninstall removes the binary. The binary embeds the files it writes to the configuration directory, so the repository can move or disappear afterwards.
Synopsis
proxyctl
proxyctl init
proxyctl up [service]
proxyctl down --yes [service]
proxyctl stop --yes [service]
proxyctl restart [service]
proxyctl ps
proxyctl logs [-f] [service]
proxyctl routes
proxyctl routes add <host> <port|url>
proxyctl routes remove <host>...
proxyctl certs
proxyctl domains list
proxyctl domains add <domain>...
proxyctl domains remove <domain>...
proxyctl domains check <host>...
proxyctl help | --help | -h
service is traefik or fallback. Without a service, the command applies to both. fallback serves a diagnostic page when no route matches the requested host name.
Configuration directory
The whole configuration of the proxy lives in one directory: $LOCAL_PROXY_DIR when the variable is set, otherwise proxyctl in the user configuration directory ($XDG_CONFIG_HOME/proxyctl, by default ~/.config/proxyctl). proxyctl help prints the directory in use.
| Path | Content |
|---|---|
compose.yaml | Compose file of the proxy (project local-proxy, containers local-proxy and local-proxy-fallback). |
traefik.yaml | Static configuration of Traefik. |
domains.txt | Domains the certificate covers, one per line. Lines starting with # are comments. |
routes.txt | Routes to services outside Docker, one <host> <url> per line. |
dynamic/ | Files Traefik reloads without restarting: tls.yaml and routes.yaml, generated by proxyctl, and the route files you write yourself. |
fallback/ | Diagnostic page served when no route matches. |
certs/ | mkcert certificates and keys, mode 700. |
Every command except init, up and help needs compose.yaml in this directory. Without it, the command exits with code 1 and names the directory.
Interactive dashboard
proxyctl
With no argument, when standard input and standard output are terminals, proxyctl opens a dashboard in the terminal. It lists the routes of the proxy, grouped and sorted by subdomain.
| Key | Action |
|---|---|
↑ ↓ | Select a route. |
/ | Filter the list. |
d | Diagnose the selected host: rule, backend, certificate coverage, HTTPS probe and suggested fix. |
l | Show the logs. |
u | Start the proxy, with its network and certificate. |
R | Restart the proxy. |
c | Regenerate the certificate. |
D, twice | Remove the proxy containers (docker compose down). |
q | Quit. |
When standard input or standard output is not a terminal, proxyctl with no argument runs proxyctl ps.
init
proxyctl init
Creates the configuration directory, dynamic/ and certs/, then writes the embedded files that are missing: compose.yaml, traefik.yaml, domains.txt, routes.txt and the diagnostic page. It never overwrites an existing file. To get a newer version of a file, delete it, then run proxyctl init again.
up
proxyctl up [service]
Runs init, creates the shared Docker network when it is missing, generates the certificate when dynamic/tls.yaml is missing or points to missing files, then runs docker compose up -d. The network is named proxy (LOCAL_PROXY_NET changes the name) and uses the subnet 10.99.0.0/24.
proxyctl up
down and stop
proxyctl down --yes [service]
proxyctl stop --yes [service]
down removes the proxy containers, stop stops them. Both cut every project the proxy serves: their domains stop answering. The containers and data of those projects are not touched. Without --yes, the command prints what it would cut and exits with code 3.
proxyctl stop --yes
restart, ps and logs
proxyctl restart [service]
proxyctl ps
proxyctl logs [-f] [service]
restart restarts the proxy or one service. ps shows the state of the proxy containers, stopped ones included; status is an alias. logs shows the last 100 lines of logs; -f or --follow keeps following them. These commands run docker compose in the configuration directory and exit with its exit code.
proxyctl logs -f traefik
routes
proxyctl routes
Lists the routes Traefik serves, read from its internal API, grouped by domain. Each line gives the host, the backend, its health and the provider (docker for container labels, file for dynamic/). A host that the certificate does not cover is marked hors certificat. When the Traefik API does not answer, the command exits with code 1 and suggests proxyctl up.
routes add
proxyctl routes add <host> <port|url>
Serves a service that runs outside Docker.
| Argument | Description |
|---|---|
host | Host name ending in .localhost, such as app.my-project.localhost. A one-level wildcard (*.my-project.localhost) is accepted. |
port | Port on your computer. proxyctl writes the target http://host.docker.internal:<port>. |
url | Full http:// or https:// URL. A URL on localhost, 127.x.x.x or ::1 exits with code 2: from the Traefik container, these addresses point to the container itself. |
The command checks that no other router (Docker labels or a hand-written file) already serves the host; if one does, it exits with code 1 and names that router. When the Traefik API does not answer, it skips this check and says so. When the certificate does not cover the host, it adds the wildcard of the parent level (*.my-project.localhost) to domains.txt and regenerates the certificate before writing the route. It then writes the route to routes.txt, generates dynamic/routes.yaml, and waits up to six seconds for Traefik to load the route. A host already in routes.txt gets the new target.
The server must listen on 0.0.0.0: Traefik reaches it through host.docker.internal, not through the loopback of your computer.
proxyctl routes add app.my-project.localhost 5174
routes remove
proxyctl routes remove <host>...
Removes routes from routes.txt and regenerates dynamic/routes.yaml. The domains stay in the certificate; proxyctl domains remove removes them. A route written by hand in dynamic/ is removed by deleting its file.
proxyctl routes remove app.my-project.localhost
Expose a Docker service
Add the service to the external proxy network with two Traefik labels in the Compose file of your project. TLS is on by default, so no tls label is needed.
services:
web:
networks: [default, proxy]
labels:
- traefik.enable=true
- traefik.http.routers.my-project-web.rule=Host(`web.my-project.localhost`)
- traefik.http.services.my-project-web.loadbalancer.server.port=8000
networks:
proxy:
external: true
loadbalancer.server.port is the port the service listens on inside its container. Router names are shared by every project of the computer; prefix them with the project name. Then declare the domain once with proxyctl domains add '*.my-project.localhost'.
certs
proxyctl certs
Regenerates the certificate from domains.txt with mkcert. The new certificate is written under a new name (certs/local-<timestamp>.pem) and dynamic/tls.yaml is rewritten to point to it, which Traefik reloads without restarting. The command then opens a TLS connection to check that Traefik serves the new certificate. If it does not, the command restarts Traefik; if Traefik still does not serve it, the command restores the previous tls.yaml when its files still exist, and exits with code 1. The previous certificate is kept and older ones are deleted. A lock file, certs/.certs.lock, prevents two generations at the same time. When Traefik is not running, the certificate is read at its next start.
Edit domains.txt by hand only when needed, then run proxyctl certs. dynamic/tls.yaml is generated: do not edit it.
domains
domains list
proxyctl domains list
Prints the domains of domains.txt, one per line.
domains add and domains remove
proxyctl domains add <domain>...
proxyctl domains remove <domain>...
Adds or removes lines in domains.txt, then regenerates the certificate when the file changed. Every domain is validated before the first write. A domain is written in lower case, with letters, digits and hyphens, and ends in .localhost. A wildcard is allowed in first position only. *.localhost alone exits with code 2: browsers and curl ignore a wildcard that covers a whole top-level domain. A wildcard covers one level: *.my-project.localhost covers web.my-project.localhost, not a.b.my-project.localhost. remove removes the exact line.
proxyctl domains add '*.my-project.localhost'
domains check
proxyctl domains check <host>...
For each host, opens a TLS connection to 127.0.0.1:443 with that host name and checks the certificate against the mkcert certificate authority. It prints couvert for a covered host and NON couvert with the error code (ERR_TLS_CERT_ALTNAME_INVALID, UNABLE_TO_VERIFY_LEAF_SIGNATURE, ECONNREFUSED…) for the others. It exits with code 1 when at least one host is not covered.
proxyctl domains check app.my-project.localhost
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success. help always exits with 0. |
| 1 | Failure: Docker, mkcert or the Traefik API failed, the configuration directory is missing, a host is already served, or domains check found a host that is not covered. |
| 2 | Wrong usage: unknown command or service, missing argument, invalid domain or target. |
| 3 | down or stop without --yes. |
up, down, stop, restart, ps and logs exit with the exit code of docker compose once it has run.
Environment variables
| Variable | Role |
|---|---|
LOCAL_PROXY_DIR | Configuration directory. Takes precedence over $XDG_CONFIG_HOME/proxyctl. |
XDG_CONFIG_HOME | User configuration directory. Default: ~/.config. |
LOCAL_PROXY_NET | Name of the shared Docker network. Default: proxy. |
PROXYCTL_DEBUG | When set, an error also prints its chain of causes. |