Let me add a bit of clarification here, since you specifically asked about
https://localhostUsing http with localhost is a mostly security context, but it has some quirks[0]. Using https://localhost will give you the full security context but then you're typically stuck either dealing with certs manually or using a proxy, like caddy. lcl.host should simplify your setup.
We're big fans of caddy by the way and even sponsor the project. Matt's doing amazing work over there.
[0] https://web.dev/articles/when-to-use-local-https