I want to create a tunnel between my custom domain (e.g., backend.dinhanhthi.com
) and my locally hosted server (e.g., http://localhost:3000
). For this, I'll use Cloudflare's Zero Trust, which is free.
You can access Zero Trust from the Cloudflare dashboard or via this link.
Follow these steps: Create a tunnel → Choose Cloudflared → Give it a name → Save tunnel → (install cloudflared
following the docs) and then:
cloudflared tunnel run...
sudo cloudflared service install ...
Next, click "Next" and configure Public hostnames:
backend
dinhanhthi.com
(select from the list)localhost:3000
(URL)Then click "Complete setup."
You can now check the result based on the option you chose earlier (cloudflared tunnel run
or sudo cloudflared service install...
).
Remarks:
If you don't have a custom domain and need a simpler solution, consider using ngrok instead.