How to setup Cloudflare Tunnel to access internal services from public cloud
Cloudflare Tunnel setup summary
Cloudflare Tunnel setup explains how to create a tunnel and publish an application in under 5 minutes. A tunnel lets Cloudflare securely proxy traffic from a public hostname to a private service running on your server, without opening inbound firewall ports.
Requirements
Cloudflare account (can be free account)
A domain available in Cloudflare DNS. The domain does not need to be registered through Cloudflare; it can stay with another registrar as long as Cloudflare is authoritative for DNS by using Cloudflare nameservers.
An internal server or VM with internet access where
cloudflaredcan be installed (Windows, Debian, Redhat, Docker)
Main steps
In the Cloudflare dashboard, go to Networking > Tunnels.
Select Create Tunnel, give it a name, then create it.
Choose the server operating system and architecture.
Copy and run the generated
cloudflaredinstall/run commands on the server.Wait until the tunnel shows as Healthy.
Add a published application route that maps a public hostname to your local service.
Enter the service URL, such as
http://mcp.domain.com:80,https://mcp.domain.com:443, or another internal IP and port.Add the route so Cloudflare creates or updates the proxied DNS record and sends traffic through the tunnel. This works when the hostname’s DNS zone is active in Cloudflare, even if the domain is registered with another registrar.