Cloudflared Tunnel

Cloudflared Tunnel exposes applications running on your local web server on any network with an internet connection with an outbound tunnel that connects directly to Cloudflare's edge network without the need to configure inbound firewall rules.

 

Overview

The Cloudflared tunnel is an open-source project by Cloudflare and is free to use with Cloudflare hosted domains at no additional charge. Note that references to Argo in various documentation are out of date and Argo is not required to be enabled on your account to use this. Cloudflared is free to use and works with a free Cloudflare account.

The open-source Cloudflared.exe tunnel is packaged with current Moxie.Build downloads in the Cloudflared subfolder. Note the link to the Cloudflared License agreement contained in that folder, or review it here.

 

Configuration

The configuration of Cloudflared for your Moxie.Build instance is independent of its Windows Service Installation. When starting with a clean system, you will need to complete the configuration before you install the Window Service.

You should first configure and test your tunnel configuration on your workstations before you move the tunnel configuration files to your Moxie.Build Cloudflared/cfg folder on the production server. Be sure to not leave the tunnel also running on your workstation after testing it. The documentation to configure and test your tunnel configuration can be found here.

A new Moxie.Build download provides an example config.yml file. This file is similar but provides a bit more details than the one provided by the above Cloudflared configuration doc.

Once the tunnel has been tested successfully on your workstation, the following files should be copied to the Moxie.Build Cloudflared/cfg folder on the production system:

Further tunnel commands, including listing and deleting existing tunnels, can be found here. Note that all tunnel commands are Cloudflare account-wide, not domain-specific.

If you are configuring multiple domains or performing additional tunnel admin tasks within the same Cloudflare account, you can continue to use the same cert.pem file in your user profile. Once you are done using cloudflared.exe for your current session, delete the cert.pem file from your user profile and empty your recycle bin.

 

Windows Service Installation

The Moxie.Build Server Setup window will install one Cloudflared service per Moxie.Build service as part of the service installation process if the Cloudflared/cfg/config.yml file exists. If this file does not exist at the time of the install, the Cloudflared service will not be installed. To add the Cloudflared service to a Moxie.Build service that is already installed, first uninstall the Moxie.Build service and then reinstall the services with the Cloudflared/cfg/config.yml file present.

Cloudflared's documentation regarding installing the Cloudflared Windows Service is not required or recommended as a result of the above. 

 

Warnings

If you copy a complete live Moxie.Build instance to another server or workstation with the Cloudflared folder and then install the services, you will end up with live traffic being routed to that instance. When making development copies of a Moxie.Build instance, do not copy the Cloudflared folder. However, note that the Run Server as App.bat file does not start the Cloudflared service, but it is possible to run the Cloudflared service from the command line for testing purposes as per the configuration instructions above.

 

Further Reading

Additional information from the Cloudflared Doc pages that may be useful: