B. Blue Green a software delivery tutorial
Vol. I § Zero-downtime series § A series for junior developers
Zero-downtime delivery · 5 / 10 ·

Caddy holds the public port

So far there are two slots but no front door. Caddy is that door: a reverse proxy listening on :8080 that forwards traffic to one of the slots. Readers never know — and never need to know — which slot is currently active.

The route in Caddy carries an @id so the playbook can patch the upstream without rewriting the whole config.

One route, one upstream

Before the switch, dial points at 127.0.0.1:18080. After the switch, the same route points at 127.0.0.1:18081. The reader's URL never changes.

Slot playground · caddy-switch
readerCaddy :8080blue :18080 · upgreen :18081 · up
Caddy points at blue on :18080.
  1. Caddy points at blue on :18080.
  2. The same route now points at green on :18081.
diff · caddy
"dial": "127.0.0.1:18080"
"dial": "127.0.0.1:18081"

Quick recap

  • Caddy is the only thing facing the public; slots stay hidden on loopback.
  • The @id lets the upstream be patched surgically — not rewritten from scratch.
  • The route must be seeded before the first deploy; the playbook patches, it does not create.
  • The switch is a single PATCH — no proxy restart, no gap.

Reader notes

Chapter discussion appears once Giscus is connected to the site repository.