{
    # Debug: enable request logging
    admin off
}

# Catch-all: Synology forwards decrypted HTTP traffic to this port.
# Route based on path regardless of Host header.
:8080 {
    # HLS segments, thumbnails, uploaded raw files
    @uploads {
        path /uploads/*
    }
    handle @uploads {
        uri strip_prefix /uploads
        root * /app/uploads
        file_server
    }

    @api path /api/*
    handle @api {
        reverse_proxy api:3001 {
            header_down -Origin
        }
    }
    handle {
        reverse_proxy frontend:3000
    }
}
