惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
T
Tenable Blog
T
Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Security Latest
Security Latest
P
Privacy & Cybersecurity Law Blog
Google Online Security Blog
Google Online Security Blog
SecWiki News
SecWiki News
P
Palo Alto Networks Blog
TaoSecurity Blog
TaoSecurity Blog
Webroot Blog
Webroot Blog
Spread Privacy
Spread Privacy
O
OpenAI News
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
C
Check Point Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
人人都是产品经理
人人都是产品经理
S
Security @ Cisco Blogs
Scott Helme
Scott Helme
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
T
Troy Hunt's Blog
W
WeLiveSecurity
GbyAI
GbyAI
N
News | PayPal Newsroom
Y
Y Combinator Blog
C
Cisco Blogs
H
Help Net Security
The GitHub Blog
The GitHub Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 【当耐特】
Jina AI
Jina AI
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
小众软件
小众软件
N
News and Events Feed by Topic

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Edge-Cached Localhost Tunnels: How to Give Stakeholders a Production-Fast Preview Directly from Your IDE
InstaTunnel · 2026-05-27 · via DEV Community

IT
InstaTunnel Team
Published by our engineering team
Edge-Cached Localhost Tunnels: How to Give Stakeholders a Production-Fast Preview Directly from Your IDE
There is a specific kind of pain that every developer knows. You have spent two days building a feature. It looks incredible on your machine. You share a localhost tunnel link with a product manager in another city, and the first thing they say is: “It’s really slow. Is something broken?”

Nothing is broken. The JavaScript bundle for your Next.js app is 4 MB. Your home internet upload speed is 20 Mbps. The laws of physics have just made you look bad.

This article explains how to solve that problem permanently by routing your localhost tunnel through a CDN edge cache — serving heavy static assets globally at low latency while keeping your backend entirely local.

Why Standard Localhost Tunnels Fall Apart at Scale
A localhost tunnel works by forwarding every request from a public URL through an encrypted connection back to your development machine. Tools like ngrok, Cloudflare Tunnel, and Traforo all operate on this basic model.

The problem is bandwidth. Modern frontend build artifacts are large. A typical React or Next.js application in development mode ships unminified JavaScript, source maps, and hot module reloading infrastructure. A single full-page load can transfer 5–15 MB of assets. With a standard residential upload speed of 20–50 Mbps, a remote user in another region is going to experience 3–8 seconds of load time before anything renders — and that is on a good day, without other devices sharing the connection.

The fix is not faster internet. The fix is to stop routing static assets through your machine altogether.

The Architecture: A CDN Reverse Proxy in Front of Your Local Machine
The core insight is that your localhost tunnel does not need to serve everything. Static assets — JavaScript chunks, CSS files, fonts, images, SVGs — are cacheable by definition. They do not change between requests. If you can instruct a CDN edge network to cache them on first load, every subsequent request from anywhere in the world gets served from a data center 50 milliseconds away, not from your laptop 200 milliseconds and one residential upload pipe away.

The architecture looks like this:

Browser → CDN Edge Node → [CACHE HIT] ─────────────────────────────────► Response
→ [CACHE MISS] → Localhost Tunnel → Your Machine → Response

(stores in edge cache)
Dynamic API requests (/api/*) and WebSocket connections for Hot Module Reloading bypass the cache entirely and hit your machine directly. Everything else — the static shell of your application — gets absorbed by the edge after the first request.

Tool Comparison: What Actually Exists in 2026
The original version of many articles on this topic describes “ngrok Cloud Edges” as the enterprise solution for configuring sophisticated caching policies in the cloud. That information is now outdated. ngrok deprecated its Cloud Edges feature as of December 31st, 2025, replacing it with a Traffic Policy system that is both simpler and more capable. If you are reading documentation that references Edges → Routes → Modules, you are reading legacy content.

Here is the accurate state of the tooling landscape:

Cloudflare Tunnel (cloudflared)
Cloudflare Tunnel is the most production-grade option. You install a lightweight daemon called cloudflared on your machine, which establishes outbound, post-quantum encrypted connections to Cloudflare’s global network. No inbound ports. No public IP exposure. No firewall rules.

The significant advantage for the edge-caching use case is that Cloudflare Tunnel routes traffic through Cloudflare’s full CDN stack automatically. CDN caching, WAF, Bot Management, and DDoS protection are applied before requests ever reach your origin. You map a public hostname to a local service, and Cloudflare handles the rest.

~/.cloudflared/config.yml

tunnel:
credentials-file: ~/.cloudflared/.json

ingress:

  • hostname: preview.yourapp.com service: http://localhost:3000
  • service: http_status:404 cloudflared tunnel run Cache behaviour is controlled through Cloudflare’s Cache Rules dashboard (available on all plans) or through Cache-Control headers sent by your local dev server. If your server sends Cache-Control: public, max-age=31536000, immutable on static assets, Cloudflare will cache them at the edge. If it sends no-cache or no-store, Cloudflare will respect that and pass every request through. The implication: you must configure your framework to cooperate, which is covered below.

Traforo
Traforo is a genuinely useful open-source tool that fills a different niche: zero-configuration edge tunneling with built-in caching support, no Cloudflare account required.

It works by connecting your local client to a Cloudflare Durable Object via WebSocket. HTTP requests to the tunnel URL are forwarded to the Durable Object, which relays them to your machine, then caches the response at Cloudflare’s edge for subsequent requests.

npm install -g traforo

Basic tunnel

traforo -p 3000

With edge caching enabled

traforo -p 3000 -c

Run your dev server and tunnel it simultaneously

traforo -p 5173 -- vite
traforo -p 3000 -- next start
The tunnel URL is https://{tunnel-id}-tunnel.traforo.dev. Traforo also supports password protection (--password) and custom tunnel IDs (-t my-app) for persistent URLs. WebSocket connections (used by HMR) are proxied through automatically, not cached. The tool is well-suited for quick, informal stakeholder demos without the setup overhead of Cloudflare Tunnel.

ngrok (with Traffic Policy)
With the deprecation of Cloud Edges, ngrok now uses a Traffic Policy system — a unified configuration layer that works consistently across the agent CLI, SDKs, and dashboard. Traffic Policy is generally available as of mid-2025.

ngrok has repositioned itself in 2026 as a “Developer Gateway” rather than a simple tunneling tool. Its strongest features are in API observability: request replays, live traffic inspection, webhook verification, and automated tunnel lifecycle management via API. For pure static asset caching, Cloudflare Tunnel or Traforo are more direct fits.

ngrok’s 2026 pricing tiers start at a free plan (1 GB/month, 1 active endpoint), Personal at $8/month (5 GB, 1 persistent domain), and Pro at $20/month (15 GB, load balancing, IP restrictions).

Note: the free tier injects an interstitial browser warning page for all HTML traffic to prevent phishing abuse. This will break client-facing demos. You need at least a paid plan for clean stakeholder preview URLs.

Configuring Your Dev Server to Cooperate
The CDN layer can only cache what your dev server allows it to cache. Most development servers send conservative Cache-Control headers by default, specifically to ensure developers always see the latest code. You must override this for static assets when running in tunnel mode.

Next.js
// next.config.js
module.exports = {
async headers() {
// Only apply aggressive caching when the edge tunnel is active
if (process.env.TUNNEL_ACTIVE !== 'true') return [];

return [
  {
    // Next.js static chunks are content-addressed (hashed filenames)
    // so immutable caching is safe — a new deploy produces new URLs
    source: '/_next/static/(.*)',
    headers: [
      {
        key: 'Cache-Control',
        value: 'public, max-age=31536000, immutable',
      },
    ],
  },
  {
    // Public directory assets
    source: '/static/(.*)',
    headers: [
      {
        key: 'Cache-Control',
        value: 'public, max-age=3600',
      },
    ],
  },
];

Enter fullscreen mode Exit fullscreen mode

},
};
Run your tunnel with: TUNNEL_ACTIVE=true next dev

The immutable directive is safe here because Next.js uses content-hashed filenames for static chunks. A file named _next/static/chunks/framework-abc123.js will never be updated in place — a new build produces a new hash. The CDN can cache it indefinitely.

Vite (React / Vue / Svelte)
// vite.config.js
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [
{
name: 'tunnel-cache-headers',
configureServer(server) {
server.middlewares.use((req, res, next) => {
// Cache compiled assets — Vite uses hashed filenames in dev mode too
if (req.url?.match(/.(js|css|woff2|woff|svg|png|webp|ico)(\?.*)?$/)) {
res.setHeader('Cache-Control', 'public, max-age=3600');
}
// Never cache HTML — the entry point must always be fresh
if (req.url === '/' || req.url?.endsWith('.html')) {
res.setHeader('Cache-Control', 'no-cache');
}
next();
});
},
},
],
});
The HMR Problem and How to Handle It
Hot Module Replacement is the feature that makes development feel instant: you save a file, and the browser updates the changed component without a full reload. It works over WebSockets. The dev server pushes diffs to the browser client in real time.

If your CDN layer intercepts and caches WebSocket upgrade requests, HMR breaks. Your stakeholders will need to manually refresh the page to see changes you make live, which defeats the point of a live demo.

The correct approach is to whitelist WebSocket connections so they bypass the cache and tunnel directly to your machine. In a Cloudflare Worker or custom edge middleware:

// Inside your edge worker or proxy handler
export default {
async fetch(request, env) {
const upgradeHeader = request.headers.get('Upgrade');

// Pass WebSocket connections directly — never cache them
if (upgradeHeader === 'websocket') {
  return fetch(request);
}

// For standard HTTP GET requests, check the cache first
const cache = caches.default;
const cachedResponse = await cache.match(request);
if (cachedResponse) return cachedResponse;

// Cache miss — fetch from origin and store
const response = await fetch(request);
if (response.headers.get('Cache-Control')?.includes('public')) {
  event.waitUntil(cache.put(request, response.clone()));
}

return response;

Enter fullscreen mode Exit fullscreen mode

},
};
Cloudflare Tunnel handles this automatically because it proxies WebSocket connections natively. Traforo also proxies WebSocket connections through the Durable Object pipeline without caching them. If you are rolling a custom setup, the WebSocket bypass is non-negotiable.

The Practical Impact
For client reviews
A stakeholder clicking a preview link and seeing your application load in under a second builds confidence. Explaining that it is slow because it is running on your laptop in a coffee shop does not. Edge caching ensures the first visual impression is production-grade regardless of where you are working.

For asynchronous QA
Without edge caching, every reload of the QA session costs upload bandwidth from your machine. With caching, the CDN absorbs page reloads. Your laptop only handles lightweight JSON API calls. QA can test independently while you continue working on bandwidth-intensive tasks locally.

For iteration speed vs. CI/CD cost
Automated CI/CD pipelines that deploy every branch to Vercel, Netlify, or AWS Amplify solve the performance problem but add a 3–5 minute feedback loop for each commit. Edge-cached localhost tunnels collapse that loop to near-zero: you press save, the change is visible via HMR, and cached static assets mean the remote user never feels the latency of your machine. For quick informal feedback rounds, this eliminates the need for a dedicated staging environment entirely.

Security Considerations
A few things worth keeping in mind when exposing local servers publicly:

Scope your tunnel. Do not tunnel your entire machine. Map only the specific port your dev server uses. Both Cloudflare Tunnel and Traforo support per-service routing.

Use password protection or access policies for sensitive work. Traforo supports --password. Cloudflare Tunnel integrates with Cloudflare Access for OAuth-gated previews.

Never cache authenticated endpoints. If your API routes return user-specific data, ensure they send Cache-Control: private or no-store. Cache only public, unauthenticated static assets.

Close tunnels when not in use. A public URL pointed at your localhost is an open door. Ctrl+C closes it. For Cloudflare Tunnel running as a service, cloudflared tunnel cleanup removes the route from DNS.

Summary
The standard localhost tunnel model — one HTTP connection from the public URL all the way to your laptop — does not scale to modern frontend bundle sizes or global stakeholders. The solution is a CDN reverse proxy layer that caches static assets at the edge after the first request, leaving only dynamic API traffic and WebSocket connections to reach your machine.

In 2026, the three practical paths to this are:

Cloudflare Tunnel — most robust, full CDN stack, requires a Cloudflare account and a domain
Traforo — open-source, zero-config, built-in -c caching flag, best for quick demos
ngrok with Traffic Policy — strongest observability tooling, best for API-heavy workflows, note that Cloud Edges were sunset at end of 2025
Configure your dev server to emit Cache-Control: public on static assets when the tunnel is active, bypass WebSocket connections to preserve HMR, and your stakeholders get a production-fast experience regardless of where your laptop is sitting.

Related InstaTunnel pages
Continue from this article into the most relevant product guides and workflows.

Webhook testing tool
Use stable HTTPS tunnel URLs for provider webhooks, retries, and local callback debugging.
Localhost tunnel guide
Expose a local app securely with a public URL for QA, demos, mobile testing, and integrations.
Plans and limits
Compare Free, Pro, and Business limits for tunnels, MCP endpoints, bandwidth, and teams.
InstaTunnel documentation
Read setup steps, CLI commands, webhook guides, MCP usage, and troubleshooting workflows.
Related Topics

localhost edge caching, CDN reverse proxy, optimize tunnel performance, hybrid local development, Next.js tunnel acceleration, cloudflare tunnel static cache, edge asset distribution, speeding up local shared urls, remote stakeholder testing, Vercel edge proxy, frontend asset caching, local environment optimization, web development tunnels, bypassing upload bottlenecks, static asset edge delivery, caching compiler assets, reverse proxy caching 2026, fast feedback loops, edge-gated dev servers, web performance local tools, asset delivery network proxy, accelerating remote staging, shared localhost optimization, jamstack tunnel proxy, local server cloud delivery, optimizing dynamic webhooks, low-bandwidth tunnel fix, production-grade local urls, smart proxy static routing, developer experience workflows