Cloudflare Tunnels
This guide will show you how to use Cloudflare Tunnels. With Cloudflare Tunnels you can use a domain with an SSL certificate for your website.
Requirements
- A Cloudflare account
- A domain name with Cloudflare DNS
- A website running on our servers.
Getting started
1. Login to Cloudflare
Navigate to the Cloudflare Zero Trust Dashboard (If it asks you to select a plan to pay for, close that tab and open a new one. All of the things we need are available in the Free plan) and login with your Cloudflare account.
Then, on the sidebar, click on Zero Trust, open the dropdown menu under the Networks section, and select Tunnels.
2. Create a Tunnel
-
Click on
Create a Tunnel -
Choose
Select Cloudflared -
Enter a name for your tunnel (e.g.: "My Website Tunnel" or "AFK Hosting Tunnel")
-
Click
Save Tunnel -
Select the
Windowsoption and copy the command that is shown. It should look something like this:cloudflared.exe service install ey... -
Open your server's Startup tab and paste the command into the
Cloudflared Tunnel Tokenfield, then REMOVE THEcloudflared.exe service installPART so it looks like this:eyabOigTzHBvW0UU82RWenDe6UfGfwE2nCIS3zJOJi4vjwQnEvcO6p2uRNuv1T87huOibpkhLgqpzZhUDcEBCyXKuwvpbv7UsORcIOF1EC6Vsotq3uufLM1QyJfFirI3MPqTzkcbD8XeNTBgQfwZrMpRyZgFYcbmTanTFBf1CyieTuxR1V7QyUh8 -
Toggle the
Enable Cloudflare Tunnelswitch toON -
Restart your server.
-
Once your server has restarted, you should now see a new item in the
Connectorssection of the Tunnels dashboard. Once you see this, click theNextbutton. -
You will now be taken to the
Public Hostnametab. Here you can create a hostname for your website.- Website
- SnailyCAD
-
Subdomain: This is the subdomain you want to use for your website. For example, if you want to use
store.example.comthen you would enterstorehere. -
Domain: The domain connected to your Cloudflare account. Use the domain you want to use for your website.
-
Path: Leave empty.
-
Service Type: Select
HTTP -
URL: Go to the
Consoletab of your server, copy theAddressfield, and paste it here. For example, if your address isus1.afkhosting.win:39600, then you would enterus1.afkhosting.win:39600here.
Click the
Complete Setupbutton to create the hostname. You can now visit your website by going to the subdomain you just created (e.g.,store.example.com) instead of the Address in theConsoletab.SnailyCAD Client Tunnel
In the current form, enter the information for your SnailyCAD Client. This is the URL that you will use to access the CAD.
- Subdomain: This is the subdomain you want to use for your SnailyCAD Client. For example, if you want to use
cad.example.comthen you would entercadhere. - Domain: The domain connected to your Cloudflare account. For example, if you want to use
cad.example.comthen you would enterexample.comhere. - Path: Leave empty.
- Service Type: Select
HTTP - URL: Go to the
Networktab of your server, copy the Hostname and Port for allocation that you created for the SnailyCAD Client, and paste it here seperated by a colon (:). For example, if your Hostname isus1.afkhosting.winand your Port is39600, then you would enterus1.afkhosting.win:39600here. Click theComplete Setupbutton to create the hostname.
SnailyCAD API Tunnel
The current tunnel only accepts the SnailyCAD Client, so you will need to create a second Public Hostname for the SnailyCAD API. To do this, follow the steps below:
- Click on the name of the tunnel you just created.
- Click on the
Editbutton in the upper right corner. - Navigate to the
Public Hostnametab. - Click on
Add a public hostname. - Enter the configuration for your domain:
- Subdomain: This is the subdomain you want to use for your SnailyCAD API. For example, if you want to use
cad-api.example.comthen you would entercad-apihere. - Domain: The domain connected to your Cloudflare account. For example, if you want to use
cad-api.example.comthen you would enterexample.comhere. - Path: Leave empty.
- Service Type: Select
HTTP - URL: Go to the
Networktab of your server, copy the Hostname and Port for allocation that you created for the SnailyCAD API, and paste it here seperated by a colon (:). For example, if your Hostname isus1.afkhosting.winand your Port is39601, then you would enterus1.afkhosting.win:39601here.
- Subdomain: This is the subdomain you want to use for your SnailyCAD API. For example, if you want to use
- Click
Save. You should now see two Public Hostnames in thePublic Hostnametab. One for the SnailyCAD Client and one for the SnailyCAD API.
Configuring SnailyCADYou will need to configure SnailyCAD to use the new Public Hostnames you just created. Follow the steps below to do this:
- Go to the
Startuptab of your SnailyCAD server. - Set the
Client URLto the Public Hostname you created for the SnailyCAD Client. For example,https://cad.example.com. - Set the
API URLto the Public Hostname you created for the SnailyCAD API. For example,https://cad-api.example.com. (Note: DO NOT add/v1at the end of the URL) - Set the
Domainto the domain you used for the Public Hostnames. For example,example.com.
To apply the changes, you will need to restart your SnailyCAD server.
You can now visit your SnailyCAD Client by going to the subdomain you just created (e.g.,
cad.example.com) and your SnailyCAD API by going to the subdomain you created for it (e.g.,cad-api.example.com).