Skip to content

next/image serves unoptimized local image with max-age=0 #26587

Closed
@igordanchenko

Description

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

14.17.1

What browser are you using?

Chrome, Safari

What operating system are you using?

macOS

How are you deploying your application?

next start

Describe the Bug

Next/image serves local images with max-age=0 when using "unoptimized" flag.

import image2 from "../public/image2.png";
...
<Image src={image2} width={730} height={300} layout="fixed" unoptimized  />

This image is served with Cache-Control: public, max-age=0 header, which forces browsers to revalidate the image every time they load a page.

In comparison an optimized image is served with Cache-Control: public, max-age=315360000, immutable header.

Expected Behavior

Cache-control header for "unoptimized" images should be no different from the optimized ones since image content is hashed and the image is assigned a unique name.

To Reproduce

Here is the code sandbox demonstrating this issue - https://codesandbox.io/s/nextjs-unoptimized-image-0svlt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions