Expose local service with Cloudflare (Argo) Tunnel

Setup Cloudflare repository

https://pkg.cloudflare.com/

Below is for Ubuntu 20.04

echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/ focal main' |
sudo tee /etc/apt/sources.list.d/cloudflare-main.list
sudo curl https://pkg.cloudflare.com/cloudflare-main.gpg -o /usr/share/keyrings/cloudflare-main.gpg

Install cloudflared

sudo apt update
sudo apt install cloudflared

Login Cloudflare

cloudflared tunnel login

In the opened browser, login Cloudflare, and choose an account to operate.

Go back to the terminal screen afterwards.

Create Cloudflare tunnel

Replace my-tunnel-name with anything you like.

cloudflared tunnel create my-tunnel-name

Note the returned tunnel-id like xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx

Route the tunnel

my-domain.com should be in the account chosen.

my-tunnel should not be on the DNS record of my-domain.com

my-tunnel.my-domain.com will be automatically created after running this command.

cloudflared tunnel route dns my-tunnel-name my-tunnel.my-domain.com

Route to local application

nano ~/.cloudflared/mytunnel.yml

Replace url with the local application detail.

Replace your computer account name in the path of credentials-file.

url: http://localhost:80
tunnel: xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx
credentials-file: /home/me/.cloudflared/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx.json

Start the tunnel

cloudflared tunnel --config ~/.cloudflared/mytunnel.yml run

https://my-tunnel.my-domain.com should now points to your location application.