Traefik vs Caddy (2026): Which Reverse Proxy Fits Docker? 14 Measurements

Traefik vs Caddy (2026): Which Reverse Proxy Fits Docker? 14 Measurements

Traefik vs Caddy is the question that almost always comes right after “Nginx or not Nginx”. Both reverse proxies are written in Go, both fetch HTTPS certificates on their own, and both run well in Docker. The difference is the mental model. Caddy reads a config file that you write. Traefik reads the Docker socket and builds its routes from the labels on your containers. That sounds like a matter of taste. In production, though, it decides what happens when a container dies, when you make a typo, or when someone attaches a container to the network without meaning to publish it.

We set both up side by side on 30 November 2026: Traefik 3.8.0 and Caddy 2.11.9 in Docker, in front of the same two test containers (traefik/whoami), bound to 127.0.0.1 only. Then we measured, stopped things, broke things and reloaded. Three results up front:

1. There is no speed winner. Both handled about 16,800 requests per second with a median latency of 2.5 ms. The bottleneck was the backend, not the proxy.

2. When we stopped one of two containers, Traefik kept returning 100 out of 100 responses with 200. Caddy with its default config returned a 502 in 49 out of 100 requests. Two lines of config fix it, but you have to know about them.

3. Traefik without exposedbydefault=false makes every container reachable, even one with no labels at all. In our test a “secret” container came straight back with a 200.

If you are not sure what a reverse proxy actually does, start with What is a reverse proxy?. We measured the comparison with the old favourite in Caddy vs Nginx.

This video (October 2026) puts Caddy, Traefik and Nginx Proxy Manager side by side for a homelab and then walks through a full Caddy setup. Below is what we found when we measured it ourselves.

Traefik vs Caddy: the difference in one sentence

Caddy asks: “What’s in my file?” Traefik asks: “Which containers are running right now, and what do their labels say?”

With Caddy you write a Caddyfile listing every domain and target. When a new service arrives, you add a block and reload. That’s easy to read, everything lives in one place, and the file can go into Git.

With Traefik you put the routing rule on the container itself, as a Docker label. Traefik watches the Docker socket, sees the new container and creates the route. Start a container and it’s reachable within seconds. Stop it and the route disappears. Nobody has to maintain a central file.

Traefik 3.8Caddy 2.11
ConfigurationLabels on containers + static start optionsOne file (Caddyfile) or JSON API
New servicesAutomatic via Docker/KubernetesAdd a block + caddy reload
HTTPSVia a certresolver you set upAutomatic for every domain in the Caddyfile
Needs the Docker socketYes (for Docker discovery)No
DashboardBuilt inNone (admin API on localhost)
Image size (measured)293 MB (65 MB compressed)92 MB (25 MB compressed)
Idle RAM (measured)20.6 MiB10.5 MiB
LicenseMITApache 2.0

A Caddyfile for two backends looks like this:

:80 {
	@app host app.localhost
	reverse_proxy @app gmtc-app1:80 gmtc-app2:80
}

The same thing in Traefik is three labels on the container:

services:
  app:
    image: traefik/whoami
    labels:
      - traefik.enable=true
      - traefik.http.routers.app.rule=Host(`app.localhost`)
      - traefik.http.services.app.loadbalancer.server.port=80

Scale the service to two containers and Traefik spreads traffic across both without any further changes.

Isometric bridge at night with colourful containers and a glowing tower that controls the connections to them

Measurement 1: throughput and latency

We measured with wrk (4 threads, 50 concurrent connections, 10 seconds), two runs per proxy, on a 12-core server:

Requests/s (run 1 / 2)Median99th percentile
Traefik16,726 / 16,8962.50 / 2.55 ms10.27 / 9.43 ms
Caddy16,780 / 16,9642.56 / 2.54 ms9.51 / 9.06 ms
Backend directly, no proxy17,9632.22 ms11.93 ms

The gap between the two is under one percent, which is noise. The last row is more interesting: without a proxy the backend itself only managed just under 18,000 requests per second. So both proxies cost about 6 percent and roughly 0.3 ms at the median. For almost every real application the proxy isn’t the bottleneck. The application behind it is.

If you find benchmarks online where one of them is far ahead, check what was measured. Usually it’s a static “hello world” on a single core, where differences in the Go runtime show up. Behind an app that talks to a database they vanish.

Memory was the only clear difference. After startup Traefik used 20.6 MiB and Caddy 10.5 MiB. After the load tests it was 58.6 MiB versus 27.3 MiB. On a small VPS that doesn’t matter. On a Raspberry Pi running lots of services you might notice it. For comparison, our production Caddy (outside Docker) serves more than 160 sites from a Caddyfile of almost 1,300 lines and uses about 190 MB.

Measurement 2: load balancing out of the box

We sent 100 requests to each proxy and counted which of the two containers answered:

Traefik:  50 × app1   50 × app2
Caddy:    45 × app1   55 × app2

Traefik uses round robin by default (weighted since 3.x). Caddy picks at random by default (lb_policy random). Over time that evens out too, but over small samples it wobbles. If you want strict rotation, add lb_policy round_robin to the reverse_proxy block. For sessions that must stick to one backend, both have a cookie option (lb_policy cookie in Caddy, sticky.cookie in Traefik). The different methods are explained in What is a load balancer?.

Measurement 3: a container goes down

This is the most important test in the comparison. We stopped gmtc-app2 and again sent 100 requests to each proxy:

Traefik:  100 × 200
Caddy:     51 × 200   49 × 502

Traefik sees through the Docker socket that the container is gone and drops it from rotation. When we started it again, it was back in after three seconds (10 of 20 requests).

Caddy knows nothing about Docker. It has two targets in its file, and one of them no longer resolves. The log says:

dial tcp: lookup gmtc-app2 on 127.0.0.11:53: server misbehaving

Without extra settings Caddy tries a backend exactly once and then passes the error on to the visitor. With random selection that hits roughly every second request. The fix is two lines:

reverse_proxy @app gmtc-app1:80 gmtc-app2:80 {
	lb_try_duration 2s
	fail_duration 30s
}

lb_try_duration tells Caddy to keep trying other backends for up to 2 seconds. fail_duration remembers failed backends for 30 seconds so they aren’t tried again in the meantime. The result:

Caddy settingSuccessfulslowest requestaverage
Default51 / 100––
lb_try_duration 2s100 / 1001.51 s–
+ fail_duration 30s100 / 1000.25 s3.8 ms

lb_try_duration alone does save every request, but some visitors then wait over a second while Caddy first runs into the dead backend. Only with fail_duration does Caddy learn from it. If you list several backends in Caddy, always set both lines. For active checks there’s also health_uri, which makes Caddy poll the backends itself.

Traefik has a second advantage: it respects Docker health checks. We started a container with a health check that never passes. While it was starting and later unhealthy, Traefik answered its domain with 404. The container didn’t receive a single request. How to write such checks is covered in Docker healthcheck.

Two connected server racks, one of them cracked and glowing red, representing a failed backend

Measurement 4: new services without a restart

In Traefik we started a third container with a new domain and timed the first 200: 2.09 seconds after docker run, including container startup. Nothing had to be changed on the proxy.

Then we made it harder. Under ongoing load (50 connections, 8 seconds) we started five containers and deleted them again. Traefik answered 135,540 requests during that time with 0 errors. The constant rebuilding of routes didn’t disturb live traffic.

In Caddy, “new service” means: add a block to the Caddyfile, then caddy reload. A reload took 117 to 129 ms for us. Under load we measured three reloads with a real change. Out of about 70,000 requests each, wrk reported 3, 15 and 4 read errors. Those are keep-alive connections Caddy closes when it switches over. A browser simply reconnects, a load testing tool counts them as errors. There were no real 5xx responses. On a server you reload a few times a day, that’s irrelevant. On a platform where containers come and go every minute, the Traefik model is cleaner.

There’s a middle way, by the way: the community plugin caddy-docker-proxy teaches Caddy to read labels like Traefik. We didn’t test it here. It’s not an official part of Caddy, and you need a custom image for it.

Measurement 5: what happens with a typo?

Everyone makes typos. The question is whether everything goes down when you do.

Caddy: we deliberately wrote lb_try_duration as lb_try_duraton and reloaded:

Error: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy':
unrecognized subdirective lb_try_duraton, at /etc/caddy/Caddyfile:4

Exit code 1, the old config kept running, the site answered 200. That’s how it should be. To check before reloading, use caddy validate --config /etc/caddy/Caddyfile.

Traefik: we started a container with the rule Host(typo.localhost), without the backticks around the domain. Traefik logged an error, marked exactly that router as disabled and left all others alone:

typo@docker  disabled  error while parsing rule Host(typo.localhost): ... typo.localhost is not defined
app@docker   enabled

The broken domain returned 404, everything else kept running. That’s forgiving too. The catch: the error shows up only in the log and the dashboard. docker compose up reports success and the container runs. If you don’t look, you only find out from the 404.

The trap that caught us

On our first attempt the broken Caddy reload returned exit code 0 and the site kept working. That looked like a bug in Caddy. It was our Docker setup. We had mounted the single file (-v ./Caddyfile:/etc/caddy/Caddyfile) and edited it with sed -i. sed -i writes a new file and replaces the old one. The container, however, stays attached to the old file. So Caddy reloaded the unchanged config and reported “success”.

The same thing happens with any editor that writes a new file on save (vim with default settings, many IDEs). The fix: mount the directory, not the file:

services:
  caddy:
    image: caddy:2
    volumes:
      - ./caddy:/etc/caddy:ro     # directory, not ./Caddyfile
      - caddy_data:/data          # certificates! never skip this

With the directory mounted, the typo immediately came back as exit code 1. You can check at any time with docker exec caddy cat /etc/caddy/Caddyfile.

Measurement 6: HTTPS out of the box

This is where the two differ more than the marketing suggests.

Caddy does HTTPS automatically for every hostname in the Caddyfile. For a public domain it fetches a certificate from Let’s Encrypt (or ZeroSSL as a fallback) and renews it on its own. For local names like app.localhost it creates its own small certificate authority. In our test the certificate came from “Caddy Local Authority – ECC Intermediate”, valid for 12 hours, renewed continuously by Caddy. There’s nothing to configure, you just need to persist the /data directory. Otherwise Caddy requests new certificates on every restart and eventually runs into Let’s Encrypt’s rate limits.

Traefik only does HTTPS when you tell it to. With tls=true on the router but no certificate source, we got:

issuer=CN = TRAEFIK DEFAULT CERT
notAfter=Nov 30 2027

A self-signed certificate that every browser rejects. For real certificates you have to set up a certresolver with ACME, an email address and a storage file (acme.json, permissions 600), and reference it on every router:

command:
  - --entrypoints.websecure.address=:443
  - --certificatesresolvers.le.acme.email=admin@example.com
  - --certificatesresolvers.le.acme.storage=/letsencrypt/acme.json
  - --certificatesresolvers.le.acme.tlschallenge=true
labels:
  - traefik.http.routers.app.tls.certresolver=le

It’s not much work, but it’s a few more lines you can get wrong. If you need wildcard certificates, both require the DNS challenge. Traefik has the provider integrations built in. With Caddy you need a custom build with the matching DNS module.

A document with a padlock and circular arrows above rows of servers, representing automatically renewed certificates

Measurement 7: security defaults

Traefik publishes everything you don’t forbid

We started a second Traefik, this time without --providers.docker.exposedbydefault=false. Then a container with no labels at all, just on the same network. We sent a request with its container name as the host:

Traefik without exposedbydefault=false:  200
Traefik with exposedbydefault=false:     404

Without the option, every container automatically gets a route following the pattern Host(<containername>). For test containers that doesn’t matter. For a database UI, an admin tool, or a container someone started “just for a minute”, it’s a wide-open barn door as soon as a matching DNS record exists or someone sends the right Host header. Always set exposedbydefault=false and enable services one by one with traefik.enable=true.

The Docker socket is root access

Traefik needs /var/run/docker.sock for Docker discovery. Many guides mount it with :ro and consider that safe. The :ro only prevents changes to the socket file itself. Through the socket Traefik talks to the full Docker API, and anyone with the Docker API can start containers with host access. If Traefik is ever compromised, so is the whole server. A cleaner approach is a socket proxy (for example tecnativa/docker-socket-proxy) that only lets read-only container queries through. Caddy doesn’t have this problem because it doesn’t need the socket.

The dashboard

We started the Traefik dashboard with --api.insecure=true, as nearly every beginner tutorial does. It answered on port 8080 with 200, no login whatsoever, and showed every router, service and internal address. On 127.0.0.1 that’s fine. If you expose the port, you’re giving away your whole infrastructure. In production the dashboard belongs behind its own router with a basicAuth middleware or inside a VPN.

Unknown hosts

A small oddity: for a request with an unknown host, Traefik answered 404 with “404 page not found”. Caddy in our setup (one :80 block with a host matcher) answered 200 with an empty body. That’s Caddy’s behaviour when no handler matches. For monitoring it’s awkward, because an uptime check with the wrong host reports “all green”. The fix is a final respond 404 handler in the block, or real site blocks per domain.

Measurement 8: restarts and dependencies

A full restart of the proxy container until the first 200: Traefik 797 ms, Caddy 486 ms. Both are fast enough for an overnight update.

More important is what a restart depends on. Caddy only needs its file and the /data directory. Traefik also needs a reachable Docker daemon. If Docker isn’t running, Traefik has no routes. On a pure Docker server that makes no difference, since the backends don’t run without Docker either. But if you want to reach services outside Docker (a systemd app, a second server), Traefik additionally needs the file provider with a YAML file. Then you’ve got a config file after all, just in a clumsier format than the Caddyfile.

If you go with Traefik: this video (February 2026) sets it up step by step with Docker. When you follow along, watch out for exposedbydefault=false and the dashboard.

When Caddy, when Traefik?

After measuring, the choice is less about performance and more about how your server lives.

Pick Caddy if …

  • you have a fixed set of services that rarely changes,
  • HTTPS for public domains should just work without thinking,
  • you have services outside Docker (systemd apps, static sites, other servers),
  • you want the whole config in one readable file in Git,
  • you don’t want to give the proxy a Docker socket.

Pick Traefik if …

  • containers come and go all the time (review environments, scaling, many Compose projects),
  • each project should bring its own route instead of touching a central file,
  • you use Docker Swarm or Kubernetes, where Traefik is at home as an ingress,
  • you want a dashboard with all routes and errors,
  • you want Docker health checks to drive routing automatically.

That’s why platforms like Coolify and Dokploy rely on Traefik: they start and stop containers for you and need a proxy that notices without a reload. Our comparison of the two is at Coolify vs Dokploy.

On our own main server we use Caddy. It runs lots of different services, some not in Docker at all, and the domains rarely change. One file with 160 sites is easier for us to keep track of than 160 sets of labels spread over dozens of Compose files. For an environment that constantly spins up new containers, we’d pick Traefik.

Two signposts with arrows on a platform, representing the choice between Traefik and Caddy

Checklist for both

Caddy:

  1. With multiple backends, always set lb_try_duration and fail_duration.
  2. Mount the config directory, not the single file.
  3. Persist /data as a volume, otherwise certificates are lost on every restart.
  4. Run caddy validate before each reload and check the exit code.
  5. Add respond 404 as the final handler for unknown hosts.

Traefik:

  1. Set --providers.docker.exposedbydefault=false and enable services individually with traefik.enable=true.
  2. Mount the Docker socket through a socket proxy instead of directly.
  3. Never expose the dashboard with api.insecure.
  4. Set up a certresolver and persist acme.json with permissions 600.
  5. After every deploy, check the log or dashboard for disabled routers, because typos in labels stay silent.
  6. When using several Docker networks, set --providers.docker.network, otherwise Traefik may pick the wrong container IP.

How we tested

  • Date: 30 November 2026
  • Versions: Traefik 3.8.0 (built 23 Nov 2026, Go 1.27.4), Caddy 2.11.9, traefik/whoami as the backend, Docker 29.9.3
  • Setup: dedicated Docker network, two backend containers, both proxies in parallel, all ports bound to 127.0.0.1 only. Traefik was restricted to our test containers via a label constraint so it couldn’t touch any of the server’s real containers.
  • Load: wrk with 4 threads and 50 connections, 10 seconds per run; 4 to 8 seconds for the reload tests
  • Failure tests: 100 individual requests each with curl
  • Afterwards: deleted all test containers, the network and the three images. The image list was identical to before, no test port left open.
  • Not tested: Let’s Encrypt with a real domain (we deliberately measured locally only), Kubernetes, HTTP/3 under load, the caddy-docker-proxy plugin

Conclusion

In Traefik vs Caddy there’s no faster one. Both manage the same 16,800 requests per second, both cost less than half a millisecond. Caddy needs half the RAM and has the smaller image, but that rarely decides anything.

What decides is the model. Caddy is the better proxy for a server you maintain yourself: one file, HTTPS without thinking, no Docker socket. You just need to know that Caddy doesn’t route around failed backends by default, and set the two lines for it. Traefik is the better proxy for a server that rearranges itself: containers with labels, automatic routes, health checks in routing. In return you have to close its open defaults, above all exposedbydefault and the socket.

If you’re torn between the two and only have a handful of services, start with Caddy. You can still move to Traefik later once your containers really start to move around. If you’re still weighing Caddy against Nginx, read Caddy vs Nginx. If you’re staying with Nginx, see Nginx reverse proxy setup. A complete Compose example with a proxy in front is in Docker Compose example.

Frequently asked questions about Traefik vs Caddy

Is Traefik or Caddy faster?

In our measurement, neither. Traefik handled 16,726 to 16,896 requests per second, Caddy 16,780 to 16,964, and the medians were 2.5 ms. The difference is within measurement noise. The backend on its own was only about 6 percent faster than with a proxy in front.

Which reverse proxy is better for Docker?

For a few fixed containers, Caddy is simpler because everything is in one file. For many containers that are frequently restarted or scaled, Traefik is better because it builds routes from Docker labels itself and drops failed containers from rotation immediately.

Does Caddy need the Docker socket?

No. Caddy reaches containers by their names on the Docker network and doesn’t know about Docker at all. Only the community plugin caddy-docker-proxy, which reads labels like Traefik, needs the socket.

Is it dangerous to give Traefik the Docker socket?

Yes, even with :ro. Through the socket Traefik has access to the full Docker API, which can be used to take over the whole server. A socket proxy that only allows read-only container queries reduces that risk considerably.

Does Traefik do HTTPS automatically like Caddy?

Not on its own. Without a configured certresolver, Traefik serves a self-signed “TRAEFIK DEFAULT CERT”. With an ACME resolver it fetches and renews Let’s Encrypt certificates just as automatically as Caddy, you only have to set it up once and reference it on each router.

Why does Caddy return 502 even though one backend is up?

Because by default Caddy doesn’t route around a failed backend. With two targets and random selection, almost every second request landed on the dead container in our test. With lb_try_duration 2s and fail_duration 30s in the reverse_proxy block, 100 out of 100 requests got through.

How much RAM do Traefik and Caddy use?

At idle we measured 20.6 MiB for Traefik and 10.5 MiB for Caddy, and 58.6 MiB versus 27.3 MiB after the load tests. Our production Caddy with more than 160 sites sits at around 190 MB.

Can Caddy read Docker labels like Traefik?

With the community plugin caddy-docker-proxy, yes. It generates a Caddyfile in memory from labels. It isn’t an official part of Caddy and needs its own image plus the Docker socket. We didn’t test it in this comparison.

What does exposedbydefault mean in Traefik?

With the default value true, every container in the watched Docker gets a route by its name automatically, even without labels. In our test a container without a single label was reachable straight away. With exposedbydefault=false, only containers with traefik.enable=true are published.

What happens with a typo in the config?

Caddy rejects a broken Caddyfile on reload with exit code 1 and a line number, and keeps the old config. Traefik only disables the affected router and keeps all the others running. The error then appears only in the log and the dashboard, and docker compose up still reports success.

Why doesn’t Caddy pick up my edited file?

If you mount only the single file in Docker and edit it with an editor or sed -i that writes a new file, the container keeps seeing the old one. Caddy then reloads the old config and reports success. Mount the directory (./caddy:/etc/caddy) and changes will reliably arrive.

Can I use Traefik and Caddy together?

Yes, but it rarely makes sense. One pattern is Caddy as the outer proxy for HTTPS and fixed services, forwarding one subdomain to a Traefik for changing containers. That’s two systems to maintain. In most cases one is enough.