Caddy in front of app’s Nginx via Docker Compose

Thanks, I hadn’t seen that PR. That’s interesting - my setup is slightly different in that I’ve kept Discourse’s nginx web server in place and run Caddy separately in Docker Compose in front of it, mainly to provide HTTP/3 at the edge.

There is one small Discourse-side change: I added a persistent app.yml hook so nginx uses Caddy’s X-Forwarded-For value for the real client IP when requests arrive over the Unix socket. I originally needed a Caddy X-Real-IP workaround, but after adding the nginx-side fix I was able to remove that and verify that Discourse still records the correct client IP.

I’ve also explicitly disabled QUIC 0-RTT/early data in the Caddy configuration while leaving HTTP/3 enabled, to avoid that additional early-data edge case.

My approach also enables Caddy’s HTTP access logging at the site level, which gives me Caddy’s default redaction of sensitive credential headers. I rotate the resulting Docker json-file logs at 25 MB × 3. I noticed the PR currently has its rotating log block in Caddy’s global options, which Caddy’s documentation describes as configuring runtime logging rather than HTTP access logging.

So it isn’t quite a completely untouched standard install, but it’s also a different approach from replacing nginx with Caddy altogether.

I’ll have a closer look at that PR. For now I’m mainly interested in whether there is enough interest in this approach to make a step-by-step guide worthwhile, rather than starting on one immediately.