Publishing an application normally means opening ports 80 and 443, managing certificates and exposing the server's IP address. Cloudflare Tunnel turns that around: the server connects out to Cloudflare, and Cloudflare forwards requests through that connection. The result is fewer open ports, a hidden origin and an easy place to add authentication. This guide covers when and how to use it on a VPS.
How It Works
user ─▶ Cloudflare edge (TLS, WAF, Access login)
│ (tunnel connections initiated by the server)
VPS: cloudflared ─▶ localhost:3000 app
─▶ localhost:8080 dashboard
cloudflared keeps several outbound connections to Cloudflare. Requests for configured hostnames travel through them to local services. Because connections are outbound, the firewall can block all inbound traffic except what you choose to keep, such as SSH for emergencies.
Setup Outline
- Add your domain to Cloudflare.
- Create a tunnel in the Cloudflare dashboard (or with the cloudflared CLI) and install cloudflared on the VPS with the tunnel token.
- Run cloudflared as a service so it starts on boot.
- Configure public hostnames or ingress rules that map each hostname to a local service.
- Bind your applications to localhost so they are reachable only through the tunnel.
Ingress Rules
Ingress rules map hostnames and paths to services: HTTP services on local ports, Unix sockets, or other internal addresses. End with a catch-all rule that returns 404 so unknown hostnames do not reach anything unexpectedly. Keep the configuration in version control.
Adding Login With Cloudflare Access
For internal tools (dashboards, admin panels, staging sites), put Cloudflare Access in front of the hostname: users authenticate with your identity provider or one-time codes before requests reach the tunnel. Define policies per application, for example only your company email domain or specific groups. This is a simple way to apply zero trust principles to web tools.
SSH and Other TCP Services
You can expose SSH through a tunnel hostname and connect with the cloudflared client as an SSH proxy, protected by Access policies. This lets you close port 22 to the internet. Keep a provider console path for emergencies in case the tunnel or Cloudflare account is unavailable.
Lock Down the Origin
- Bind applications to 127.0.0.1.
- Block inbound HTTP and HTTPS at the firewall if everything goes through the tunnel (see our UFW guide).
- Do not publish the server IP in DNS records for tunnelled hostnames.
- Remember Docker-published ports can bypass UFW; publish containers on localhost.
Limitations
- Designed mainly for HTTP(S) and TCP services; game servers that need direct UDP from players are not a good fit.
- All traffic depends on Cloudflare's service and your account configuration.
- Large file uploads and long-lived connections should be tested against Cloudflare's limits for your plan.
- Cloudflare terminates TLS at its edge, which is acceptable for most uses but should be considered for sensitive data.
High Availability
A single cloudflared instance is a single point of failure for the tunnel. Run cloudflared replicas on more than one server for the same tunnel, or at least monitor the service and restart it automatically. The applications behind the tunnel still need their own redundancy.
When to Use a Tunnel vs Opening Ports
| Situation | Better approach |
|---|---|
| Internal admin tools and dashboards | Tunnel with Access |
| Public website already on Cloudflare | Tunnel or proxied DNS with origin firewall |
| Game server, VoIP, UDP services | Direct ports with provider DDoS protection |
| Server-to-server private traffic | Mesh VPN such as Headscale |
Example: Securing Internal Dashboards
A startup runs Grafana, an admin panel and a staging site on one VPS, all bound to localhost. A Cloudflare Tunnel maps three hostnames to them, Cloudflare Access requires company Google login, and SSH goes through the tunnel too. The VPS firewall now blocks all inbound connections except its provider's management access.
Common Mistakes
- Leaving apps listening on public interfaces, bypassing the tunnel.
- No catch-all rule in the ingress configuration.
- Exposing internal tools through the tunnel without Access policies.
- Expecting UDP game traffic to work like HTTP.
- No emergency access path if the tunnel fails.
In Short
Cloudflare Tunnel publishes HTTP and TCP services through outbound connections, hides the origin and pairs naturally with Access for login. Bind apps to localhost, close inbound ports, add Access policies, plan for redundancy and use direct ports for UDP-heavy services. For layered defences, see our firewall vs DDoS guide.
Monitoring the Tunnel
Watch cloudflared's service status and logs, the tunnel's health in the Cloudflare dashboard, and the applications behind it. Alert when the tunnel disconnects or a hostname starts returning errors. Because users reach your apps only through the tunnel, a stopped connector looks like a full outage, so restart it automatically and test failover if you run replicas. Review Access logs periodically to see who used each internal tool.
Next Steps
Move one internal tool behind a tunnel with Access, bind it to localhost, close its public port, then repeat for the rest. Security controls only help if they keep working, so schedule a short quarterly review: confirm who still has access, apply pending updates, test that backups restore and check that nothing you closed has quietly been reopened by a later change. Document each step as you go, including the reasons for every rule and exception, so colleagues can maintain the setup confidently and auditors or customers can see how access is controlled.
SkyRainCloud Plans for This Workload
cloudflared itself is light; size the VPS for the applications behind it. 2 vCores / 8 GB suits a few internal tools; busier apps need their usual resources.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.