Expose local application on internet


I am trying to expose my local application on the internet. So from my local application I would like to click on a button, which will generate a public url, which then I can share with my team/support/customer. And when I am done sharing, I can just stop public url. What I need is can be achieved with service like “localhost.run”. I used to use “ngrok” for my purpose. But these services are not reliable.

I am trying to find if I can achieve this using cloudflare products and if yes, what do I need to do.

Cloudflare Tunnels may interest you? Wrangler2 is using tunnels for this exact purpose too.

You can find the docs for tunnels here: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide

The part I’m thinking may be difficult is the Public URL part. Like they probably want to generate a unique URL a partner can connect to.

Opening and closing access is pretty easy. But getting a unique URL to point to the same destination is a little difficult. I can only think of something like a Worker where you’d change the path match, then fetch from the regular endpoint.

It might be easier to not necessarily change the usual part of the URL, but add a Query String to an always-available URL. Then use a Firewall Rule to block if the query string doesn’t match:

Thanks for your replies.

Just to provide more information on the use case here, I have lots of raspberry pi machines in the field. And I would to initiate the tunnel from those machines. I followed instructions on available on https://blog.cloudflare.com/ssh-raspberry-pi-400-cloudflare-tunnel-auditable-terminal/ and was able to set it up, to work for one of the machines.

Now is there a way to do all these configurations programmatically? Also, with tunnel I created on one machine, it added a DNS record for that tunnel. Can I just copy config.yml, .json and cert.pem on each machine and just run a command to start tunnel ??

Also, when multiple machines are starting the tunnel at the same time, how do I generate different url,

Appreciate all the help. Thanks.

After doing more research, I found that I did not even needed an account or any setup to do what I needed. Just a “cloudflared” execulatble.
Here is a link
Now wondering, if there is any NodeJs library available for this executable.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.