DEV Community

Imamul I. nAyeem
Imamul I. nAyeem

Posted on

Expose local Web App to the internet with Cloudflare tunnels

If you are one of these people below or one of these scenarios is true for you then this blog is going to be a must-read one for you.

  • If you are a web developer often need to showcase your work to your potential clients
  • You do not have web hosting but want to use your PC as a server to host your web applications
  • You do not have a public IP to give access to your local application to your client or you do not want to expose your public IP.
  • You have a home server, and you want to expose your home services to the Internet without exposing your public IP or without having a public IP.

If you can relate to one of these scenarios, then Cloudflare Tunnel could be a savior for you. 

Cloudflare Tunnel is a tunneling software that lets you quickly secure and encrypt application traffic to any type of infrastructure, so you can hide your web server IP addresses, block direct attacks, and get back to delivering great applications.

However, you need to own a domain that needs to be managed by Cloudflare. You can buy a domain online for a pretty cheap price, or some domain provider allows users to pick a free domain. Besides, hosting domains on Cloudflare is quite straightforward, tons of blogs and videos are out there about hosting domains on Cloudflare.

Let's see how we can set how Cloudflare tunnels:

  1. First, you need to transfer your domain to Cloudflare. You can do that following this Cloudflare documentation.
  2. Then go to Cloudflare Dashboard and from Left sidebar Click on Zero Trust. It'll take you to the zero trust dashboard.
  3. Now, from sidebar click on Access to expand it then click Tunnels.

    Image access sidebar

  4. Click on Create a tunnel button. Then give a name to your tunnel and click on Save Tunnel. This will take you to Configure Test tunnel page.
    Image new tunnel

  5. Here follow the instructions to set your connector according to your operating system. I'm on a Windows machine, so I'm setting up my connector following Windows OS instructions.
    Image setup ins

  6. After configuring this, switch to Public Hostname tab.
    Image p host

  7. Now, Click on the Add a public hostname button and fill in the information below. This localhost site will be exposed to the testpage.imamul.com.bd. Here, you can also add a URL path with or without a subdomain and the service type should be your local site type. If your site is running on https then select HTTPS. You can also add any local IP instead of localhost.

    Image new pubhost

That is it. Your local site is now exposed to the internet. Anyone can access your site with this URL testpage.imamul.com.bd without knowing your public IP.

Top comments (0)