Locally, every Waddle project needs to be reachable at its own domain, myproject.localhost, side
by side with every other project on the same machine. That routing is handled by the proxy, which
is built into Waddle itself.
How it routes
The proxy listens on ports 80 and 443 on your machine and picks the project from each connection:
- HTTPS (443): the hostname the browser asks for in the TLS handshake (SNI).
- HTTP (80): the request’s
Hostheader.
It then connects to that project’s webserver and passes the traffic through untouched. It never terminates TLS, rewrites headers or buffers request bodies. The project’s own webserver handles its certificate, HTTP/2, WebSockets, body limits etc. and redirects with the same config it uses in production. Locally, your site behaves the way it will on a server.
A route covers the project’s domain and every subdomain of it. Requests for a domain no project
claims are refused (HTTPS) or answered with a 404 (HTTP).
How projects connect to it
Each project’s docker-compose.override.yml publishes the web container’s webserver ports on a
random local port and labels the container with its domain and which of its ports serve HTTP and
TLS (com.waddlehub.router.*). The proxy reads those labels from Docker and updates its routes
whenever a project’s container starts or stops. It reads no project files, so there is nothing to
configure per project. See The Three Docker Compose Files.
Where it runs
The proxy runs in the background as an operating system service, set up during installation:
| OS | Service |
|---|---|
| Linux | systemd unit waddle-router.service |
| macOS | launchd agent com.waddlehub.router |
| Windows | Windows service WaddleRouter |
The Proxy menu in Waddle’s title bar shows whether it’s running and lets you start,
stop or restart it. From a terminal, use waddle proxy start, waddle proxy stop or
waddle proxy restart.
Uninstalling Waddle removes the service on Linux. On Windows and macOS it stays behind and takes one extra step to remove, see Removing Waddle.
Using your own proxy
The proxy is optional. If you’d rather use your own, ignore the defect Waddle reports when the proxy service is missing, or the one reporting that something else already holds ports 80 and 443. Waddle then skips all of its proxy checks and hides the Proxy menu. Projects are still published on a random local port with the same labels, so your own proxy can route to them. For a ready-made setup, see Alternative proxy using Docker below.
Alternative proxy using Docker
If you’d rather not run Waddle’s proxy as a system service, nginx-proxy (for example) can do the same job from a Docker container. It reads each project’s domain from an environment variable and routes to it over a shared Docker network. Unlike Waddle’s proxy, it terminates TLS itself and opens a new HTTPS connection to the project’s Nginx, so it needs its own copy of each project’s certificate.
1. Turn off Waddle’s proxy
Skip the proxy service when installing Waddle, or turn it off if it’s already installed. On Linux,
run sudo systemctl disable --now waddle-router.service. On Windows and macOS, follow the steps specifically to remove the service in
Removing Waddle.
2. Set up nginx-proxy
Create the shared network once:
docker network create nginx-proxy
Then create a folder for the proxy, with an empty certs/ folder and this docker-compose.yml:
services:
nginx-proxy:
image: nginxproxy/nginx-proxy
container_name: nginx-proxy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs:ro
- ./settings.conf:/etc/nginx/conf.d/settings.conf:ro
networks:
- nginx-proxy
networks:
nginx-proxy:
external: true
The settings.conf raises nginx-proxy’s buffer sizes, since platforms like Magento send response
headers too large for its defaults:
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
Start it with docker compose up -d. Waddle now reports that something else holds ports 80 and 443.
Ignore that defect, and Waddle switches off its proxy checks.
Please note that depending on how Docker and the proxy container are configured, the
nginx-proxynetwork or container may not come back after a reboot, for example if Docker isn’t set to start on boot. If your projects stop responding, first confirm that the network exists (docker network ls) and the container is running (docker ps) before investigating anything else.
3. Connect your projects
Projects need to join the nginx-proxy network and tell it their domain. Make the change in
docker-compose.override.yml in a fork of the templates repository,
so every new project gets it. For an existing project, make the same change in its own
templates/docker-compose.override.yml and rebuild it.
In the web service, add nginx-proxy to its networks list, and add these environment variables:
web:
networks:
- nginx-proxy
# ...the project's existing networks stay as they are
environment:
- VIRTUAL_HOST={{public.website.url}},*.{{public.website.url}}
{{#if ssl.enabled}}
- VIRTUAL_PROTO=https
- VIRTUAL_PORT={{public.nginx.https_port}}
- CERT_NAME={{ssl.cert_name}}
{{/if}}
Then declare the network at the end of the file:
{{#if public.nginx.install}}
networks:
nginx-proxy:
external: true
{{/if}}
nginx-proxy ignores the ports and com.waddlehub.router.* labels already in the file. Only
Waddle’s proxy uses them, so you can leave them in place or remove them. Keeping them means you can
switch back to Waddle’s proxy later without editing the file again.
4. Copy the certificates
Waddle creates each project’s local certificate in the project’s ssl/ folder, named after the
project’s folder. Copy both files into the proxy’s certs/ folder:
cp ~/.waddle/projects/myproject_localhost/ssl/myproject_localhost.{crt,key} certs/
Copy them again whenever you change a project’s domain, since Waddle creates a new certificate then.
To automate the copy, add it to bin/deploy/run (and bin/deploy/run.ps1 on Windows) in your
fork of the templates repository, right after the mkcert line
that generates the certificate. Point it at your own proxy folder:
cp "./ssl/{{ssl.cert_name}}.crt" "./ssl/{{ssl.cert_name}}.key" ~/nginx-proxy/certs/
Every build then copies the current certificate for you. Changing a domain creates the new certificate without running the deploy script, so after a domain change, rebuild the project or copy the files by hand.
Local only
The proxy is strictly a local development convenience. On remote servers there is no proxy, and each project’s Nginx binds its ports directly to the host, see The Three Docker Compose Files.
There are two known limits locally. The client IP your project sees is Docker’s gateway address rather than the browser’s, and HTTP/3 isn’t supported.