Exposing Local Projects to the Web with Cloudflared: A Quick Guide
Ever needed to quickly share a local project with someone without deploying it? Cloudflared makes it incredibly easy to expose your local development server to the web temporarily. Whether you’re showing off a new feature, getting feedback on a design, or testing an API,...
Ever needed to quickly share a local project with someone without deploying it? Cloudflared makes it incredibly easy to expose your local development server to the web temporarily. Whether you’re showing off a new feature, getting feedback on a design, or testing an API, Cloudflared tunnels provide a secure, instant solution.
# Ubuntu/Debiancurl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64.debsudo dpkg -i cloudflared.deb
# Verify installationcloudflared --version| Command | Description | Quick Example |
|---|---|---|
| cloudflared tunnel —url | Create temporary tunnel to local service | cloudflared tunnel —url http://localhost:8000 |
| cloudflared tunnel login | Authenticate with Cloudflare account | cloudflared tunnel login |
| cloudflared tunnel create | Create a named permanent tunnel | cloudflared tunnel create my-project |
| cloudflared tunnel list | List all your tunnels | cloudflared tunnel list |
| cloudflared tunnel run | Run a named tunnel | cloudflared tunnel run my-project |
| cloudflared tunnel cleanup | Clean up tunnel connections | cloudflared tunnel cleanup my-project |
| cloudflared —version | Check current version | cloudflared —version |
| cloudflared update | Update to latest version | cloudflared update |
- Create a test HTML file:
My Project
Hello from my local server! This is being served from my development machine.- Start a local server:
# Navigate to your project directorycd ~/my-project
# Start Python's built-in serverpython3 -m http.server 8000- Create the tunnel:
# In another terminalcloudflared tunnel --url http://localhost:8000- Share the URL: You’ll see output like:
Your quick Tunnel has been created! Visit it at:https://abc123def.trycloudflare.com# Start your React dev servernpm start# Server runs on http://localhost:3000
# Create tunnel (new terminal)cloudflared tunnel --url http://localhost:3000# Start Flask apppython app.py# API runs on http://localhost:5000
# Create tunnelcloudflared tunnel --url http://localhost:5000# 1. Login to Cloudflarecloudflared tunnel login
# 2. Create named tunnelcloudflared tunnel create my-dev-project
# 3. Run the tunnelcloudflared tunnel run my-dev-projecttunnel: my-dev-projectcredentials-file: ~/.cloudflared/my-dev-project.json
ingress: - hostname: my-project.example.com service: http://localhost:8000 - service: http_status:404Share your latest UI changes with designers and stakeholders instantly.
Let backend developers test your API endpoints without complex deployments.
Share Jupyter notebooks or data visualizations with colleagues.
Demonstrate work-in-progress features to clients securely.
Allow QA teams to test features before they’re production-ready.
-
Temporary tunnels are perfect for short-term sharing
-
Named tunnels require Cloudflare account authentication
-
URLs are publicly accessible – don’t expose sensitive data
-
Always stop tunnels when you’re done sharing
-
Quick tunnels: Active until you stop the process
-
Named tunnels: Can run indefinitely until manually stopped
-
No uptime guarantees for free temporary tunnels
“Connection refused” error:
# Check if your local server is runningcurl http://localhost:8000
# Verify the port is correctnetstat -tulpn | grep :8000Tunnel not accessible:
# Check tunnel statuscloudflared tunnel list
# Restart tunnelcloudflared tunnel cleanup my-tunnelcloudflared tunnel run my-tunnelPort already in use:
# Find what's using the portlsof -i :8000
# Kill the processkill -9| Action | Command |
|---|---|
| Stop current tunnel | Ctrl + C |
| Kill all cloudflared processes | pkill cloudflared |
| Stop specific tunnel | cloudflared tunnel cleanup |
| Check active processes | ps aux | grep cloudflared |
-
Test locally first – Always verify http://localhost:PORT works before creating a tunnel
-
Use descriptive tunnel names – Makes management easier
-
Keep track of active tunnels – Use cloudflared tunnel list regularly
-
Set up aliases for common commands:# Add to ~/.bashrc or ~/.zshrc alias tunnel=‘cloudflared tunnel —url’ alias tunnels=‘cloudflared tunnel list’
-
Combine with tmux/screen for persistent sessions
-
Official Cloudflared Documentation
-
Cloudflare Tunnel GitHub
-
Cloudflare One Documentation
This guide is perfect for developers who need to quickly share local projects without the complexity of full deployments. Cloudflared makes secure, temporary exposure of local services incredibly simple and accessible.
Have you used Cloudflared for your projects? Share your experiences in the comments!
#cloudflared #webdevelopment #devops #cloudflare #localdevelopment