Expose localhost to the network using Cloudflare Tunnel
MUHAMMAD ARBAB ANJUM

MUHAMMAD ARBAB ANJUM @arbab529

About: Exploring DevSecOps

Location:
Karachi, Pakistan
Joined:
Jun 6, 2022

Expose localhost to the network using Cloudflare Tunnel

Publish Date: Aug 25 '25
5 0

Install cloudflared

Download from: https://github.com/cloudflare/cloudflared/releases
Enter fullscreen mode Exit fullscreen mode

Change Dir

cd C:\cloudflared\
Enter fullscreen mode Exit fullscreen mode

Login to Cloudflare

cloudflared tunnel login
Enter fullscreen mode Exit fullscreen mode

Create tunnel

cloudflared tunnel create nextjs-tunnel
Enter fullscreen mode Exit fullscreen mode

Route DNS

cloudflared tunnel route dns nextjs-tunnel test.myworkly.com
Enter fullscreen mode Exit fullscreen mode

Create config.yml file in C:\cloudflared\config.yml

tunnel: nextjs-tunnel
credentials-file: C:\Users\%USERNAME%\.cloudflared\[your-tunnel-id].json

ingress:
  - hostname: test.domain.com
    service: http://localhost:3000
  - service: http_status:404
Enter fullscreen mode Exit fullscreen mode

Quick Test

cloudflared tunnel --hostname test.domain.com --url http://localhost:3000
Enter fullscreen mode Exit fullscreen mode

Run tunnel pointing directly to Next.js

cloudflared tunnel --config config.yml run nextjs-tunnel
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment