Ngrok-Style Cloudflare Tunnel on Windows | cloudflared http 3000

#cloudflare#ngrok
Ngrok-Style Cloudflare Tunnel on Windows | cloudflared http 3000

Ever wished Cloudflare Tunnel worked like:

bash
ngrok http 3000

Instead of the long command:

bash
cloudflared tunnel --url http://localhost:3000

In this post, I’ll show how I turned Cloudflare Tunnel into a simple:

bash
cloudflared http 3000

Just like Ngrok.

No extra tools. No PowerShell magic. Just a tiny CMD wrapper.


Goal

Type this:

bash
cloudflared http 3000

And internally it runs:

bash
cloudflared tunnel --url http://localhost:3000

Folder Structure

Create a folder:

bash
C:\cloudflared

Put Cloudflare’s binary there and rename it to:

bash
cloudflared-core.exe

Then create a new file in the same folder:

bash
cloudflared.cmd

Final layout:

bash
C:\cloudflared
 ├─ cloudflared-core.exe
 └─ cloudflared.cmd

Make sure

Code
C:\cloudflared
is added to your Windows PATH.


cloudflared.cmd (with green UI)

Open

Code
cloudflared.cmd
and paste this:

bash
@echo off

:: Enable ANSI colors
for /f %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"

:: Colors
set GREEN=%ESC%[32m
set RESET=%ESC%[0m

echo %GREEN%==============================================%RESET%
echo %GREEN%   Cloudflared Shortcut - Ngrok Style Tunnel  %RESET%
echo %GREEN%==============================================%RESET%
echo.

:: Usage: cloudflared http 3000
if "%1"=="http" (
  echo %GREEN%[INFO]%RESET% Starting tunnel on localhost:%2 ...
  cloudflared-core.exe tunnel --url http://localhost:%2
) else (
  echo %GREEN%[INFO]%RESET% Passing command to cloudflared...
  cloudflared-core.exe %*
)

Save.


Usage

Start your local app (example: port 3000), then run the following:

bash
cloudflared http 3000

You’ll instantly get something like the following:

bash
https://random-name.trycloudflare.com

Open it, your localhost is now live. 🔥