# SSH Tunnels

### What is it Used for?

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**.

### How?

Using Cloudflare Argo Tunnels. You can find more details here: <https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide>.

### Installation

The procedure to create a tunnel is quite simple:

1. Install the Cloudflare utility on your machine: \
   `$ brew install cloudflare/cloudflare/cloudflared`
2. Connect the utility to your cloudflare account with `$ cloudflared tunnel login` and choose the **a domain that is not part of our infrastructure**
3. Create a new tunnel in Cloudflare with \
   `$ cloudflared tunnel create <tunnel_name>` (for ex `cloudflared tunnel create overloop-developers-johndoe`)
4. Add a new CNAME record to redirect the traffic to the tunnel: `$ cloudflared tunnel route dns <tunnel_UUID> <cname>` (for ex `cloudflared tunnel route dns 0327bfe5-0d20-4e92-8496-08356d5cf660 johndoe` to route the traffic to johndoe.yourdomain.com)
5. Configure your tunnel in `~/.cloudflared/config.yml`\
   for example:&#x20;

   ```
   url: http://localhost:3001
   tunnel: 0327bfe5-0d20-4e92-8496-08356d5cf660
   credentials-file: /Users/johndoe/.cloudflared/0327bfe5-0d20-4e92-8496-08356d5cf660.json
   ```
6. Start your tunnel\
   `$ cloudflared tunnel run <tunnel_UUID>` (for ex: `cloudflared tunnel run 0327bfe5-0d20-4e92-8496-08356d5cf660`)
