🏠 HOME
Such tunnels are useful to test webhooks in local for example.
The client asks an HTTP proxy server to forward the TCP connection to the desired destination, meaning that you can expose your local web server through a public URL.
Using Cloudflare Argo Tunnels. You can find more details here: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide.
The procedure to create a tunnel is quite simple:
Install the Cloudflare utility on your machine:
brew install cloudflare/cloudflare/cloudflared
Connect the utility to your Cloudflare account with command below and choose the proper A domain that is not part of our infrastructure (i.e. overloop.link):
cloudflared tunnel login
Create a new tunnel in Cloudflare with command below (for ex cloudflared tunnel create overloop-developers-johndoe
):
cloudflared tunnel create <tunnel_name>
Add a new CNAME record to redirect the traffic to the tunnel with command below (for ex cloudflared tunnel route dns 0327bfe5-0d20-4e92-8496-08356d5cf660 johndoe
to route the traffic to johndoe.yourdomain.com
):
cloudflared tunnel route dns <tunnel_UUID> <cname>
Configure your tunnel in ~/.cloudflared/config.yml
. For example:
url: <https://localhost:3000>
tunnel: 0327bfe5-0d20-4e92-8496-08356d5cf660
credentials-file: /Users/<MY_USER>/.cloudflared/0327bfe5-0d20-4e92-8496-08356d5cf660.json
Start your tunnel with command below (for ex: cloudflared tunnel run 0327bfe5-0d20-4e92-8496-08356d5cf660
):
cloudflared tunnel run <tunnel_UUID>
Make sure that you added your certificate to Keychain or you may encounter this error:
2023-07-11T09:23:35Z ERR error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: x509: certificate signed by unknown authority" cfRay=7e4cfd203fa9f962-BRU event=1 originService=https://localhost:3000
2023-07-11T09:23:35Z ERR Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: x509: certificate signed by unknown authority" connIndex=3 dest=https://johndoe.overloop.link/favicon.ico event=0 ip=198.41.200.23 type=http
<aside> <img src="/icons/playback-previous_lightgray.svg" alt="/icons/playback-previous_lightgray.svg" width="40px" /> Bug Fixing 101
</aside>
<aside> <img src="/icons/playback-next_lightgray.svg" alt="/icons/playback-next_lightgray.svg" width="40px" /> Collaborating to this Playbook
</aside>