Switching url to https causes a 404 error

Check your server logs. They are usually pretty clear about a 404.

Which SSL setting are you using at Cloudflare? It’s probably Full or Flexible.

Finally, what’s the domain? “Not Secure” is usually caused by Mixed Content.