Discourse with Caddy v2 on Docker

Okay, that fixed a thing. Changing the volume mapping to- '/var/caddy/Caddyfile:/etc/caddy/Caddyfile' gets a cert and loads http and https.

Then it was loading a blank page, with the following new error:

"http.log.error","msg":"making dial info: upstream unix:/sock/nginx.http.sock: invalid dial address unix:/sock/nginx.http.sock: address sock/nginx.http.sock: missing port in address"

Google lead me here: v2: reverse_proxy “missing port in address”, but it didn’t look like the same issue.

Another search of the docs lead me to Network Addresses, where I found:

Valid examples:

:8080
127.0.0.1:8080
localhost:8080
localhost:8080-8085
tcp/localhost:8080
tcp/localhost:8080-8085
udp/localhost:9005
unix//path/to/socket

And so, the other problem was that I needed to change the : from v1 to a / for v2. Boom:

v1

proxy / unix:/sock/nginx.http.sock {
   transparent
}

v2

reverse_proxy unix//sock/nginx.http.sock

Working! Thank you!

Bonus: Cloudflare is also working through the proxy after adding an API key.

2 Likes