You can set an HTTPS address of your localhost as a valid URL for a Telegram web app application; it just needs to be an HTTPS address.
For example, in Next.js, you can launch your application with the --experimental-https flag, which will generate a self-signed certificate. After that, you can set the address https://127.0.0.1:3000 for your web application in @BotFather, and it will work just fine.