--- myst: html_meta: "description lang=en": "This guide provides step-by-step instructions on how to configure Kasm Workspaces with Cloudflare Tunnels and your own SSL certificates for your domain. Learn how to connect your domain to Cloudflare, set up the tunnel, connect to a public host domain, and test the connection." "keywords": "How to, How-to, Kasm, Workspaces, Cloudflare Tunnels, SSL, Certificates, HTTPS, Custom Domain, Sub-Domain, DNS, Zero Trust, Docker, Public Host Domain" "property=og:locale": "en_US" --- ```{title} Cloudflare Tunnels ``` # Cloudflare Tunnels A Cloudflare Tunnel provides secure web connectivity to your Kasm Workspaces instance without requiring a publicly routable IP address or valid external SSL certificate by routing through the Cloudflare service. In this video, we will show you how to configure Kasm Workspaces with Cloudflare Tunnels using your own DNS hostname. ## Video Tutorial If you prefer to follow along with a video tutorial, you can watch this YouTube video that covers the same steps outlined in this guide. ```{raw} html ``` ## Prerequisites ```{important} Before starting, please ensure that you have completed the following steps: 1. Deployed a Kasm instance. 2. Registered a DNS domain. 3. Set up a Cloudflare account. 4. Connected cloudflare nameservers to your domain provider. ``` ## Connecting Your Domain to Cloudflare The first step is to connect your domain to Cloudflare. To do this, you need to change the name servers for your domain to Cloudflare's name servers. Here are the steps to follow: 1. Navigate to the DNS tab on the left-hand side of your Cloudflare dashboard. ```{figure} /images/cloudflare_tunnels/dns.webp :align: center **Location of Cloudflare DNS Section** ``` 2. Scroll to the bottom and copy the two Cloudflare name servers. 3. Log in to your domain provider and replace the existing name servers with the Cloudflare name servers. ```{warning} The process of changing your domain's name servers may take up to 48 hours to propagate. ``` ### Setting up the Tunnel To set up the tunnel after connecting your domain to Cloudflare, follow these steps: 1. Navigate to the Access tab on the left-hand side of your Cloudflare dashboard and click on the "Launch Zero Trust" button. This will take you to the zero-trust dashboard, where you can access tunnels by clicking the drop-down arrow next to Access and selecting Tunnels. ```{figure} /images/cloudflare_tunnels/access.webp :align: center **Location of Cloudflare Tunnels Zero Trust** ``` 2. To install a new tunnel, click on "Create a Tunnel," give it a name, and click "Save Tunnel." 3. Select the Docker tab and copy the provided code. 4. Paste this code into a text editor of your choice, such as VS Code. ```{important} Add "-d" after the "run" section to ensure it runs in the background. ``` 4. Copy and paste the updated code into your host machine, and you'll see that it's now connected. ```{figure} /images/cloudflare_tunnels/code.webp :align: center **Example of Code With -d** ``` ```{note} For more information about installing and configuring Cloudflare Tunnel, you can refer to [the official documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps). ``` ### Connecting to a Public Host Domain Once the tunnel is connected and running, you can connect it to a public host domain. To connect your tunnel to a public host domain, follow these steps: 1. Navigate to your existing tunnel by clicking on the drop-down arrow next to "Access" and selecting "Tunnels." ```{figure} /images/cloudflare_tunnels/tunnels.webp :align: center **Location of Cloudflare Tunnels Tunnels** ``` 2. Find the name of your tunnel and click on it. 3. Click on the "Configure" button, and then click on "Public Hostname." ```{figure} /images/cloudflare_tunnels/add_hostname.webp :align: center **Location of Cloudflare Tunnels Add Hostname** ``` 4. To create a new tunnel route, enter a subdomain, such as "test," and select your domain from the dropdown menu. 5. Leave the path section blank and select "HTTPS" as the service type. 6. In the URL section, enter the IP address of your Kasm instance. 7. Click on the "Additional Application Settings" tab. 8. Enable "No TLS Verify" and "HTTP2 Connection." 9. Save the hostname. ### Testing the Connection To test the connection, you can either enter the URL into your search bar or click on the created route and then the external link. Your Kasm Workspaces instance is now accessible via your domain using Cloudflare Tunnels. ## Conclusion By following the steps outlined in this guide, you can easily configure your Kasm Workspaces with Cloudflare Tunnels and your own SSL certificates for your domain. This allows you to provide secure and convenient access to your Kasm Workspaces instance through your own domain name, with the added benefits of Cloudflare's CDN and DDoS protection.