captun

cap[nweb] tun[nel]: a tiny, fast public tunnel for local HTTP servers.

Run this with something listening on port 3000:

npx captun 3000

You get a URL like:

https://abc123.captun.sh

Requests to that URL are forwarded to your local server until you stop the process.

From code

You don't need to run a local server. Just a fetch function:

Try it in this tab

This works in any environment supported by capnweb, so you can run a "server" basically anywhere, even the browser.

Edit the fetch function, create a tunnel, then the iframe below will load the public URL.

idle

Bring your own Cloudflare account

npx captun deploy

Source: github.com/iterate/captun