v0 performance

Next.js Image Optimization Cache Not Working

Next.js Image component caching isn't working properly. Updated images still show old versions, or image optimization isn't triggered when source images change. Users see stale content.

Image caching issues occur when cache headers aren't properly configured, image paths change unexpectedly, or Vercel's Image Optimization API cache isn't invalidated.

Error Messages You Might See

Image cache not invalidating Stale images being served [Image] Cache control not set Cached image not updating
Image cache not invalidatingStale images being served[Image] Cache control not setCached image not updating

Common Causes

  1. Using query parameters in image URLs without stable naming (changing URLs prevent caching)
  2. Cache-Control headers set to no-cache or very short expiry for optimized images
  3. Image filename/path changes but URL remains same, serving stale cached version
  4. Dynamic image URLs (different URL for same image) preventing cache hit
  5. Vercel Image Optimization cache not automatically invalidating on deployment

How to Fix It

Use stable URLs: Keep image URLs consistent. If image content changes, include hash in filename: avatar-abc123.jpg

Configure cache headers: In next.config.js, set long cache for optimized images:
headers: async () => [{ source: '/assets/**', headers: [{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' }] }]

Use Image version parameter: In development, append query string: <Image src={url + '?v=' + Date.now()} /> to bust cache.

Deploy to invalidate: Vercel automatically invalidates image cache on new deployment.

Real developers can help you.

Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience Alvin Voo Alvin Voo I’ve watched the tech landscape evolve over the last decade—from the structured days of Java Server Pages to the current "wild west" of Agentic-driven development. While AI can "vibe" a frontend into existence, I specialize in the architecture that keeps it from collapsing. My expertise lies in the critical backend infrastructure: the parts that must be fast, secure, and scalable. I thrive on high-pressure environments, such as when I had only three weeks to architect and launch an Ethereum redemption system with minimal prior crypto knowledge, turning it into a major revenue stream. What I bring to your project: Forensic Debugging: I don't just "patch" bugs; I use tools like Datadog and Explain Analyzers to map out bottlenecks and resolve root causes—like significantly reducing memory usage by optimizing complex DB joins. Full-Stack Context: Deep experience in Node.js and React, ensuring backends play perfectly with mobile and web teams. Sanity in the Age of AI: I bridge the gap between "best practices" and modern speed, ensuring your project isn't just built fast, but built to last. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services ISHANTDEEP SINGH ISHANTDEEP SINGH Senior Software Engineer with 7+ years of experience in React, JavaScript, TypeScript, Next.js, and Node.js. I’ve also worked as a tech lead for startups, owning end-to-end technical execution including architecture, development, scaling, and delivery. I bring a strong mix of hands-on coding, product thinking, and technical leadership, and I’m comfortable building products from scratch as well as improving and scaling existing systems. AUXLE AUXLE I am a Full Stack Developer experienced in building Websites, Web apps and Cross Platform Mobile Apps for Startups and Companies. Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

How long should images be cached?

For static images: max-age=1 year (31536000 seconds). For dynamic avatars: max-age=1 day or use version query param.

Why is my updated image still showing old version?

URL is cached. Change filename or add ?v=timestamp to force cache bust. Next.js Image caches based on URL.

Does Vercel Image Optimization cost extra?

Free tier: 1000 optimizations/month. Paid: $0.15 per 10,000 additional. Caching reduces cost.

Related v0 Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help