Testing Local Apps in Production with Cloudflared
Learn how to use Cloudflared tunnels to expose local applications securely to the internet for real production style testing.
2026-05-08 • 4 min read
Testing Local Apps in Production with Cloudflared
When developing applications locally, one major challenge is testing them in a real world environment.
Your application may work perfectly on
localhostThis is where
cloudflaredCloudflared allows you to create a secure tunnel between your local machine and the internet without deploying your application to a cloud server.
With a single command, your local app becomes publicly accessible:
cloudflared tunnel --url http://localhost:8000
Cloudflare instantly generates a public HTTPS URL that forwards traffic securely to your local server.
This means you can test production style behavior directly from your laptop.
Why Use Cloudflared
Traditional deployment workflows can slow development.
Normally, developers must:
- Push code to GitHub
- Wait for CI pipelines
- Deploy to staging
- Open the preview deployment
- Begin testing
That process can take several minutes for even the smallest change.
Cloudflared removes that friction entirely.
You continue coding locally while exposing your application securely to the internet in real time.
Benefits include:
- Instant public URLs
- HTTPS enabled automatically
- No port forwarding
- No SSL configuration
- No cloud server required
- Safer than exposing raw ports
- Faster testing workflows
- Easier collaboration
Real World Use Cases
Cloudflared is useful for far more than simple demos.
Testing Webhooks
Many APIs require public callback URLs.
Examples include:
- Stripe payments
- GitHub webhooks
- Discord bots
- Telegram bots
- OAuth authentication
- Slack integrations
Cloudflared lets these services communicate directly with your local environment.
Mobile Device Testing
You can test your local app from:
- Phones
- Tablets
- Other computers
- Remote teammates
This is incredibly helpful for responsive design testing.
Sharing Work with Clients
Instead of deploying unfinished features to production, developers can simply share a temporary Cloudflare URL.
Clients can preview changes instantly.
API Development
Backend developers can simulate production traffic locally while debugging in real time.
This dramatically improves iteration speed.
Security Advantages
One of the strongest benefits of Cloudflared is security.
Unlike traditional port forwarding, cloudflared creates outbound connections from your machine to Cloudflare.
Your local IP address stays hidden.
Advantages include:
- Encrypted HTTPS traffic
- Hidden origin server
- Reduced attack surface
- No firewall changes
- Zero Trust compatibility
- Optional authentication layers
This makes testing much safer than exposing ports directly from your router.
Positive Impact on Developer Productivity
Fast feedback loops improve software quality.
When developers can test instantly without deployment delays, they experiment more freely and fix issues faster.
Cloudflared helps teams:
- Iterate faster
- Debug efficiently
- Reduce deployment overhead
- Validate integrations earlier
- Improve collaboration
- Increase confidence before releases
Small workflow improvements often create massive productivity gains over time.
Installing Cloudflared
Below are installation instructions for different operating systems and Linux distributions.
Install on Ubuntu and Debian
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloudflare-main.gpg echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared stable main" | sudo tee /etc/apt/sources.list.d/cloudflared.list sudo apt update sudo apt install cloudflared
Verify installation:
cloudflared --version
Install on Arch Linux
Using
pacmansudo pacman -S cloudflared
Or using an AUR helper:
yay -S cloudflared
Install on Fedora
sudo dnf install cloudflared
Install on CentOS and RHEL
sudo yum install cloudflared
Install on openSUSE
sudo zypper install cloudflared
Install on Alpine Linux
apk add cloudflared
Install on macOS
Using Homebrew:
brew install cloudflared
Install on Windows
Using Winget:
winget install Cloudflare.cloudflared
Using Chocolatey:
choco install cloudflared
Starting Your First Tunnel
Start your local application first:
python -m http.server 8000
Then expose it publicly:
cloudflared tunnel --url http://localhost:8000
Example output:
https://random-name.trycloudflare.com
Open the generated URL in your browser and your local application will be accessible globally through Cloudflare’s network.
Testing Production Features Locally
Cloudflared makes it easy to test:
- Authentication redirects
- Mobile responsiveness
- HTTPS only features
- External APIs
- Webhook integrations
- Third party callbacks
- Live collaboration demos
Without deploying to production infrastructure.
Developer Workflow Example
A typical workflow might look like this:
npm run dev
In another terminal:
cloudflared tunnel --url http://localhost:3000
Now your local development server behaves like a public production application.
Why Developers Love Cloudflared
Cloudflared feels lightweight yet powerful.
It removes unnecessary infrastructure complexity while improving development speed and collaboration.
Developers can focus more on building software and less on deployment overhead.
That simplicity is what makes cloudflared such an important tool in modern development workflows.
Instead of treating localhost as an isolated environment, developers can instantly create secure public access to their applications with almost zero configuration.