Cloudflared
Cloudflared is the client for Cloudflare Tunnel. It runs next to your private services, creates an outbound tunnel to Cloudflare, and lets Cloudflare route traffic to your services without exposing public ports on Sliplane.
This guide will give an example of how to set up Cloudflared on Sliplane and add a published application.
Prerequisites
Section titled “Prerequisites”- A Cloudflare account
- A domain added to Cloudflare
- A Sliplane server with private services you want to expose
Step 1: Get Your Cloudflare Tunnel Token
Section titled “Step 1: Get Your Cloudflare Tunnel Token”- Log in to the Cloudflare dashboard
- Go to Networking > Tunnels
- Click Create Tunnel
- Give your tunnel a name and click Create Tunnel
- Select Docker
- Copy the token from the install command
The token is the long string after --token in the Docker command.
Step 2: Deploy Cloudflared on Sliplane
Section titled “Step 2: Deploy Cloudflared on Sliplane”Use the Cloudflared preset to create the service:
Deploy Cloudflared
Before deploying, replace the placeholder for environment variable TUNNEL_TOKEN with the token from Step 1.
After deployment, go back to the Cloudflare dashboard. The tunnel should show as Healthy within a few seconds.
Step 3: Add a Published Application
Section titled “Step 3: Add a Published Application”In the Cloudflare dashboard:
- Go to Networking > Tunnels
- Click your tunnel
- Open the Routes tab
- Click Add route > Published application
- Set the Subdomain and Domain you want to use
- Set the Service URL to your Sliplane service’s internal hostname and port
For example, if your private service is called my-service and listens on port 3000, use:
http://my-service.internal:3000Cloudflared can reach private Sliplane services on the same server through their .internal hostnames. Public traffic goes to Cloudflare first, then through the outbound tunnel to your private service.
Step 4: Access Your Service
Section titled “Step 4: Access Your Service”Once the route is saved, open the domain you configured in Cloudflare:
https://app.example.comThe service remains private on Sliplane. Only Cloudflared connects to it internally.
Troubleshooting
Section titled “Troubleshooting”Tunnel disconnected:
- Make sure the status of the tunnel is
Healthyin the Cloudflare dashboard - Verify that
TUNNEL_TOKENis set correctly - Check the service logs in Sliplane
Requests are not reaching your service:
- Verify the internal hostname and port in the Cloudflare route
- Make sure the target service is running on the same Sliplane server
- Confirm that the target service is listening on the port you configured
Route works locally but not through Cloudflare:
- Check that your domain is active in Cloudflare
- Verify that the published application uses the right hostname
- Review Cloudflare Access rules if you enabled access policies
See Cloudflare Tunnel Troubleshooting for more resources that help you resolve issues with Cloudflare Tunnel connectivity and configuration.