vite-nginx-stale-cache-debug

Diagnoses and fixes stale Nginx cache issues for Vite React apps.

2|Updated May 10, 2026
One-click install
npx skills add https://github.com/freedomw1987/tree_monstor --skill vite-nginx-stale-cache-debug
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vite-nginx-stale-cache-debug
Source: https://github.com/freedomw1987/tree_monstor/tree/main/skills/debugging/vite-nginx-stale-cache-debug
Command: npx skills add https://github.com/freedomw1987/tree_monstor --skill vite-nginx-stale-cache-debug

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When rebuilding a Vite React application, code changes fail to appear in the browser even after clearing the cache, as Nginx serves stale cached JavaScript files with immutable cache headers, causing wasted debugging time and incorrect production behavior.

Core Features & Use Cases

  • Stale Cache Diagnosis: Verify if Nginx is serving outdated files by checking dist file modification times, HTTP cache headers (ETag, Cache-Control), and whether file content matches your latest code.
  • Permanent Fix: Configure Vite to add content hashes to output filenames so Nginx's immutable caching works correctly without serving stale files.
  • Temporary Fix: Disable Nginx's immutable caching headers to force fresh file serving during urgent deployments.
  • Use Case: Frontend developers and DevOps engineers deploying Vite-powered React apps to Nginx who encounter persistent stale code issues after rebuilds.

Quick Start

Ask the AI to diagnose and fix stale cache issues when your rebuilt Vite React app does not show recent code changes on an Nginx server.

Frequently Asked Questions about vite-nginx-stale-cache-debug

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Vite React app not update after I rebuild and deploy to Nginx?

Your Vite React app shows stale content because Nginx serves outdated JavaScript files with immutable cache headers. Vite's default query param-based cache busting fails to force Nginx to fetch newly rebuilt files.

How do I fix stale cache issues when deploying a Vite React app with Nginx?

To fix stale cache issues, configure Vite to add content hashes to output filenames or temporarily disable Nginx immutable caching headers. This ensures Nginx correctly serves fresh files after a rebuild.

How can I diagnose if Nginx is serving stale cached JavaScript files?

Diagnose stale cache by checking dist file modification times, HTTP cache headers like ETag and Cache-Control, and verifying whether file content matches your latest Vite React code changes.

Does Vite's default cache busting work properly with Nginx immutable cache headers?

Vite's default query param-based cache busting does not work well with Nginx immutable cache headers. Nginx may still serve stale files, requiring Vite configuration adjustments to add content hashes to filenames.

What is the best way to permanently prevent Nginx from serving stale Vite React files?

The best permanent fix is configuring Vite to add content hashes to output filenames. This makes Nginx's immutable caching work correctly without serving stale files during future deployments.

How do I quickly force Nginx to serve fresh Vite files during an urgent deployment?

To quickly force fresh file serving during urgent deployments, temporarily disable Nginx's immutable caching headers. This forces Nginx to bypass stale cache and fetch the latest Vite React files.