I'm using a Unix socket between Caddy and Discourse instead of TCP, but from time to time I get a 'unix:' error

Right, you can check this two links:

It seems that you are missing a header and/or your chain into Discourse template file.