Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images not being cached. The prop minimumCacheTTL is ignored and instead set to max-age=0. #532

Open
abdielou opened this issue Aug 23, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@abdielou
Copy link

Describe the bug
The NextImage minimumCacheTTL is being ignored and replaced by max-age=0. By default it should be 60. Any overrides at next.config.js, as specified by the docs, are also ignored.

To Reproduce
Steps to reproduce the behavior:

  1. Install a fresh tailwind-nextjs-starter-blog
  2. Build and serve: npm i; npm run build; npm run serve;
  3. Navigate to any page with images eg: /blog/guide-to-using-images-in-nextjs
  4. Open the Dev Tools and inspect the image's Response Headers.
  5. Validate the image's Cache-Control header.

Expected behavior
Image response headers should have a default Cache-Control with max-age=60 or as defined by minimumCacheTTL.

Instead, max-age=0 is returned, therefore disabling cache optimizations.

Screenshots
This is the Cache-Control being returned by sample images at /blog/guide-to-using-images-in-nextjs.
Screen Shot 2022-08-23 at 10 20 57 AM

But it should have a default value of 60 or as defined by minimumCacheTTL.
Screen Shot 2022-08-23 at 10 21 13 AM

Here's an example from a clean next js installation.
Screen Shot 2022-08-23 at 10 42 51 AM

System Info (if dev / build issue):

  • Deployed at Vercel

Browser Info (if display / formatting issue):

  • Browser: Chrome
@daaain
Copy link

daaain commented Dec 19, 2022

I can confirm this is still happening with a website created on 2022 December 14 at 23:12:22 GMT using @pliny/cli

image

@daaain
Copy link

daaain commented Dec 21, 2022

This is still happening even after figuring out that I have to use direct image URLs rather than reference type links in Markdown (see this commit) to get them wrapped as Next Image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants