I had similar issues, and was able to resolve this issue by moving my Cloudflare settings from SSL/TLS section from Flexible to Full(Strict). That said, I had already configured the subdomain for Nextcloud, and SWAG was configured to use Cloudflare DNS to validate the domain and create SSL/TLS certificates. Give that a shot and see if it clears anything up for you. You may also need to use the "purge cache" option in Cloudflare under overview.