Marcio Cunha

How to Point Cloudflare Quick Tunnel to Multiple Services Changing Local Ports

Learn how to expose different local applications to the internet using Cloudflare Quick Tunnel without custom domains or complex DNS setups. The article details port mapping and the practical use of temporary tunnels for testing.

Marcio Cunha12 min
Also available in:EspañolPortuguês
Summary
  • Quick tunnels generate random temporary public addresses that facilitate external testing without costs or domain registrations
  • Traffic redirection relies on correctly indicating the local port where each application runs on the machine
  • Multiple services require parallel connection instances so each local port points to a distinct public URL
  • Reverse proxy tools help consolidate ports into a single permanent tunnel when custom URLs are needed
  • Security and access control remain essential even in quick tunnels to prevent accidental data exposure

The Challenge of Exposing Local Services to the Internet

When developing software, we frequently need to show the result to a colleague in another location or test integrations with external services that require a public URL. In practice, this means our development machine needs to be accessible over the internet, breaking through the invisible barrier of the home or office router. In the past, this task required messing with complex port forwarding settings on the router, which often collided with internet provider restrictions or security risks.

Tunneling tools solved this problem by creating a secure bridge between the developer's computer and a cloud server, generating a temporary public address. Cloudflare Tunnel, part of the Cloudflare ecosystem that protects and accelerates websites on the internet, offers a very practical feature called Quick Tunnel. In practice, a quick tunnel creates a random URL ending in trycloudflare.com without requiring you to set up a custom domain, register a credit card, or create an account on the platform.

However, the default behavior of the command that starts this tunnel often confuses those who need to manage more than one application at the same time. Since the default command-line utility points to a single local port at a time, running multiple services requires understanding how to direct the data flow correctly. Understanding this dynamic avoids frustration and allows you to create an agile and functional external testing environment in just a few minutes.

Understanding How Cloudflare Quick Tunnel Works

To use the quick tunnel, we use a command-line tool called cloudflared. In practice, it acts like an invisible mail carrier that picks up requests arriving from the internet, securely packages this data, and delivers it to the program running on your computer, bringing the response back through the same path. This entire process happens encrypted, ensuring no one in the middle can read the content of the messages.

When you run the basic command to start the connection, the tool chooses a default port on your computer, usually port eighty or eighty-eight, or accepts your precise destination specification. In practice, the basic syntax requires you to provide the protocol and the port where your system is listening, such as http://localhost:3000 for a Node.js application or http://localhost:8080 for a Java administrative dashboard.

The great differential of the Quick Tunnel is the automatic generation of a temporary public web address as soon as the connection is established. Anyone in the world who opens that link in a browser will be able to see what is running on the port you specified. However, this address changes every time you close and reopen the program, reinforcing the provisional nature of this tool, which is geared toward rapid testing.

How to Direct the Tunnel to Specific Local Ports

The most direct way to point the tunnel to a non-default port is by passing the URL parameter directly in the command line. In practice, this means that if you have a website running on port four thousand one and an API running on port five thousand, you need to run separate commands clearly indicating each destination to avoid data routing confusion.

To open a tunnel for a web application running on port three thousand, for example, the command executed in the terminal looks like cloudflared tunnel --url http://localhost:3000. In practice, the tool connects to Cloudflare servers, negotiates a secure channel, and displays a long, random URL on the screen starting with https:// and ending with .trycloudflare.com, pointing directly to your local server.

If you need to change the local port midway through the process, just terminate the current command by pressing the Ctrl and C keys on your keyboard and start a new command pointing to the new port number. In practice, this manual switch is simple when testing only one thing at a time, but becomes impractical when you need to keep multiple systems running simultaneously for an integrated demonstration.

Running Multiple Tunnels Simultaneously

To bypass the limitation of one tunnel per command and expose several services at the same time, the most practical solution consists of opening multiple tabs or windows in your terminal. In practice, each terminal tab will act as an independent channel, running a separate instance of the cloudflared program pointed to a different local port.

Imagine you need to show an e-commerce system where the administrative panel runs on port thirty-one and the product storefront runs on port thirty-two. In practice, you will open the first terminal tab and run the command for port thirty-one, generating the first public link. Next, you will open a second tab, run the command for port thirty-two, and receive a second public link completely independent of the first.

Thus, you will have two distinct public URLs pointing to different local ports on the same machine. In practice, this allows you to send the storefront link to a client to test purchasing and the admin panel link to a colleague to test management, all happening simultaneously without port conflicts or the need for complex cloud infrastructure.

Advanced Alternatives with Reverse Proxy

Although opening multiple terminals works very well for emergencies and quick tests, this approach generates many different URLs to manage and can clutter your workspace with dozens of open windows. In practice, engineers usually adopt a reverse proxy, which is a centralizing program like Nginx or Caddy, to organize all traffic entering and leaving the development machine.

With a reverse proxy configured locally, you can open a single Cloudflare Quick Tunnel pointed to the port of this central proxy. In practice, the proxy reads the incoming subdomain or URL path and automatically decides which internal local port to forward the request to, acting like an intelligent switchboard transferring the call to the correct extension.

This strategy reduces the complexity of managing multiple temporary links and offers much greater control over the testing environment. In practice, you gain stability and organization, maintaining the characteristic agility of Cloudflare quick tunnels without losing control over your microservices' ports.

Best Practices and Security Considerations

Exposing local services to the internet using quick tunnels brings enormous convenience, but requires extra care to avoid unwanted security breaches. In practice, anyone who discovers or receives your temporary link will have direct access to your computer through that port, which can expose sensitive data or database tools if there is no proper protection.

Never leave database ports, such as PostgreSQL or MySQL, exposed directly in a Quick Tunnel without requiring strong passwords or prior authentication. In practice, the best approach is to use tunnels only for web applications that already have login screens or add an extra layer of protection through Cloudflare's native authentication features.

Also remember that links generated by the quick tunnel are public by nature and can be indexed or intercepted if shared on open channels. In practice, always terminate terminal processes as soon as your work is done, ensuring the bridge between your machine and the internet is completely broken.

Final Considerations on Tunnels and Local Ports

Mastering the use of Cloudflare Quick Tunnel while changing local ports transforms the development routine, allowing you to validate integrations and present results quickly and smoothly. In practice, understanding how to direct traffic correctly eliminates dependence on complex routers and accelerates the feedback cycle with clients and teams.

Whether opening multiple terminals for spot tests or structuring a reverse proxy for more complex scenarios, tunneling technology has established itself as an indispensable resource in the modern developer's toolkit. In practice, the secret lies in balancing the agility of these temporary solutions with the necessary caution regarding the security of exposed data.