Cloudflared Expose service from Port

Expose port via cloudflared tunnel is commonly used for projects that are in development or a cheap way to deploy a service from your local (I have not yet tested the stability of the connection)

Pre-requisites

To run this requires:

  • cloudflared installed if do not have yet follow this guide
  • Already authenticated for cloudflared system with cert.pem file, if do not have yet follow this guide

TL;DR

To create tunel with name example run

cloudflared tunnel create example

Create tunnel from CLI

according to official guide on machine that want the tunnel with the next command can create tunnel

cloudflared tunnel create <NAME>

for example create a tunnel with name example

cloudflared tunnel create example

If auth is ok and name has valid chars the command should output something like this

Tunnel credentials written to C:\Users\user.cloudflared\fedb123-fa123-1234-b123-1234567bd.json. cloudflared chose this file based on where your origin certificate was found. Keep this file secret. To revoke these credentials, delete the tunnel.

Created tunnel example with id fedb123-fa123-1234-b123-1234567bd

NOTE: if for some reason output something like this.

— failed to create tunnel: Create Tunnel API call failed: Failed to create tunnel: code: 10000, reason: Authentication error

Try to perform auth again and retry