Trying to use Caddy for Mastodon - Having trouble translating Caddyfile from v1 to v2

This is the config that worked in the end.

toomanycooks.social {
        @try_masto {
                file
        }

        root * /home/mastodon/live/public

        handle @try_masto {
                file_server *
        }

        handle /api/v1/streaming* {
                reverse_proxy localhost:4000
        }

        handle {
                reverse_proxy localhost:3000
        }

        encode gzip

        header / {
                Strict-Transport-Security "max-age=31536000;"
        }

        header /emoji Cache-Control "public, max-age=31536000, immutable"
        header /packs Cache-Control "public, max-age=31536000, immutable"
        header /system/accounts/avatars Cache-Control "public, max-age=31536000, immutable"
        header /system/media_attachments/files Cache-Control "public, max-age=31536000, immutable"
}

I omitted the handle_errors part because it certainly isn’t right. I’ll figure that out later.

3 Likes