When developing or testing applications locally, you may need to share them quickly over the internet. Whether it’s for demos, hackathons, or collaborative projects, tunneling tools like Cloudflare’s TryCloudflare and Gradio’s Share Feature provide effective solutions to expose local services to the public.
This guide focuses on setting up tunnels for various workloads (e.g., web services, web apps, TGI servers, VLLM services) and provides detailed steps for using these tools. The examples assume your service is running locally on a specific port (e.g., http://localhost:8080
).
Cloudflare’s TryCloudflare
Cloudflare’s TryCloudflare lets you quickly expose local services to the internet with no Cloudflare account required. While it’s intended for testing or temporary use, Cloudflare also offers premium tunnels for production-grade needs.
Why Use Cloudflare?
- Quick Setup: A single command is enough to expose your service.
- Secure: It uses Cloudflare’s global network, protecting your IP address.
- Temporary Usage: Ideal for demos or quick sharing during development.
Setting Up TryCloudflare
Install
cloudflared
:sudo apt update sudo apt install -y wget wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb sudo dpkg -i cloudflared-linux-amd64.deb
Expose a Local Service (replace
8080
with your service’s port):cloudflared tunnel --url http://localhost:8080
Share the Public URL:
After running the command, you’ll receive a public URL like:
https://<random-subdomain>.trycloudflare.com
This link is temporary and only works while the
cloudflared
process is running.
Example Workloads:
Web Service: Start your web service (e.g., Flask, FastAPI, Node.js) locally on port
8080
and usecloudflared
to expose it.TGI or VLLM Server: Run your inference server locally, bound to a port, and use
cloudflared
to expose it for collaborators or clients to test.
For Production Use:
For permanent, production-grade tunnels with custom domains, better reliability, and SLAs, consider upgrading to Cloudflare’s premium tunnel services.
Recommendations and When to Use
Cloudflare TryCloudflare: Best for quick exposure of services without additional Python dependencies. Use it for secure sharing during hackathons or short-lived projects. For production or long-term use, consider Cloudflare’s premium tunnels.
Gradio Share Feature: Ideal for Python developers or when you need a simple interface to accompany your service. Use it to share ML demos, Python apps, or lightweight experiments.
Both tools are great for development and testing but remember their limitations for production-grade usage. Choose based on your workflow and requirements.
This guide equips you with two powerful tools to expose local applications to the world, simplifying collaboration and testing. Happy sharing!