Cloudflare Tunnels
This guide will show you how to use Cloudflare Tunnels for SnailyCAD. With Cloudflare Tunnels you can use a domain with an SSL certificate for your SnailyCAD instance.
Requirements
- A domain name with Cloudflare DNS
- A SnailyCAD instance
- A Cloudflare account
Getting started
1. Login to Cloudflare
- Navigate to the Cloudflare Zero Trust Dashboard and login with your Cloudflare account.
- in the dashboard under your account → Zero Trust (one.dash.cloudflare.com) → Networks → Tunnels
2. Create a tunnel for system
You are only able to create 1 tunnel per system.
- Click on
Create a Tunnel - Enter a name for your tunnel (e.g.: "SnailyCAD Tunnel")
- Follow the instructions on the page to install Cloudflared on your server (Install Connector).
- Once connected, click
Next
3. Create Hostname for SnailyCAD API
-
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:
localhost:8080
-
-
Click
Save Tunnel -
Head back to the Tunnels dashboard.
4. Create Hostname for SnailyCAD Client
-
Click on the tunnel you just created
-
Click on the
Configurebutton -
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.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:
localhost:3000
-
-
Click
Save hostname
5. Configuring SnailyCAD
-
Open your SnailyCAD
.envfile.CORS_ORIGIN_URL: Set this to your SnailyCAD Client domain. For example,https://cad.example.comNEXT_PUBLIC_CLIENT_URL: Set this to your SnailyCAD Client domain. For example,https://cad.example.comNEXT_PUBLIC_PROD_ORIGIN: Set this to your SnailyCAD API domain. For example:https://cad-api.example.com/v1(Note: You need to add/v1at the end of the URL)
-
All Done! 🎉