Expose Local App To Internet

Sometimes we need to show case our local projects online. For that we need servers to host it or some 3rd party applications to host it for us. To simplify the need we Cloudflare has brought a simple and easy solution. Argo tunnel to expose your local app to internet. Steps are simple. They are given below.

  • Create a cloudflare account ( free dont need any billing plans for argo tunnel )
  • Install cloudflared on your system
  • For Ubuntu
    wget -q https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.deb
    dpkg -i cloudflared-stable-linux-amd64.deb
  • For Mac
    brew install cloudflare/cloudflare/cloudflared
  • Now run your app which you want to expose to the internet.
  • The app could be php node python anything, it just need to run through a port so that cloudflared could proxy the tunnel.
  • Now run this command: cloudflared tunnel --url localhost:9000
  • Here localhost:your_port_number make sure to use the port that your app is using.
    ~❯ cloudflared tunnel --url localhost:5000
    2021-10-16T14:09:50Z ERR Configuration file /usr/local/etc/cloudflared/config.yml was empty
    2021-10-16T14:09:50Z INF Thank you for trying Cloudflare Tunnel. Doing so, without a Cloudflare account, is a quick way to experiment and try it out. However, be aware that these account-less Tunnels have no uptime guarantee. If you intend to use Tunnels in production you should use a pre-created named tunnel by following: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
    2021-10-16T14:09:50Z INF Requesting new quick Tunnel on trycloudflare.com...
    2021-10-16T14:09:51Z INF +--------------------------------------------------------------------------------------------+
    2021-10-16T14:09:51Z INF |  Your quick Tunnel has been created! Visit it at (it may take some time to be reachable):  |
    2021-10-16T14:09:51Z INF |  https://go-consideration-molecular-norm.trycloudflare.com                                 |
    2021-10-16T14:09:51Z INF +--------------------------------------------------------------------------------------------+
    2021-10-16T14:09:51Z INF Cannot determine default configuration path. No file [config.yml config.yaml] in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp /etc/cloudflared /usr/local/etc/cloudflared]
    2021-10-16T14:09:51Z INF Version 2021.10.3
    2021-10-16T14:09:51Z INF GOOS: linux, GOVersion: devel +a84af465cb Mon Aug 9 10:31:00 2021 -0700, GoArch: amd64
    2021-10-16T14:09:51Z INF Settings: map[protocol:quic url:localhost:5000]
    2021-10-16T14:09:51Z INF cloudflared will not automatically update if installed by a package manager.
    2021-10-16T14:09:51Z INF Generated Connector ID: 88d35c87-6caa-4924-bdf9-97e1e01c4413
    2021-10-16T14:09:51Z INF Initial protocol quic
    2021-10-16T14:09:51Z INF Starting metrics server on
    2021/10/16 20:09:51 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
    2021-10-16T14:09:51Z ERR Failed to create new quic connection, err: Unauthorized: Record for tunnel not found
    2021-10-16T14:09:51Z ERR Register tunnel error from server side error="Unauthorized: Record for tunnel not found" connIndex=0
    2021-10-16T14:09:52Z INF Retrying connection in up to 2s seconds connIndex=0
    2021-10-16T14:09:54Z ERR Failed to create new quic connection, err: Unauthorized: Record for tunnel not found
    2021-10-16T14:09:54Z ERR Register tunnel error from server side error="Unauthorized: Record for tunnel not found" connIndex=0
    2021-10-16T14:09:54Z INF Retrying connection in up to 4s seconds connIndex=0
    2021-10-16T14:09:57Z INF Connection 6577b6a3-c665-4df0-80cb-d2584abdbfe4 registered connIndex=0 location=SIN
    2021-10-16T14:09:57Z INF Connection 15dea38f-bb60-4406-8ffe-e137d93faeaf registered connIndex=1 location=BOM
    2021-10-16T14:09:58Z INF Connection 517b2a7f-e10f-4328-9c32-fa500672d741 registered connIndex=2 location=SIN
    2021-10-16T14:09:59Z INF Connection 1166810a-46b1-4944-9ea9-9924bd06afc6 registered connIndex=3 location=BOM
  • Click on the link and you will see your app live on the public internet.
  • Yes it’s secure and optimized.
  • For exit just press Ctrl + c
  • You can use this feature on a free cloudflare account

By this way you can easily share you local project live on the internet.

Written on October 16, 2021