You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the new Image Optimization feature, it appears as though even though Cache-Control is being set, the response headers aren't including what should be automatically generated.
Describe the bug
As an example for all my static images, I am adding cache-control.
e.g.
const setHeadersForImages = (req, res) => {
res.setHeader('Cache-Control', 'public,max-age=2592000000,immutable')
return handle(req, res)
}
//This is how I was adding the headers PRE NEW IMAGE OPTIMIZATION
server.get('*.jpg', (req, res) => setHeadersForImages(req, res))
server.get('*.svg', (req, res) => setHeadersForImages(req, res))
server.get('*.png', (req, res) => setHeadersForImages(req, res))
//This is how I am adding the headers POST NEW IMAGE OPTIMIZATION
server.get(/^\/_next\/image/, (req, res) => setHeadersForImages(req, res))
I can see in the response headers that the cache control is being added just fine. But pre using the new Image Optimization, my response headers looked like:
Fixes#18563 by adding the etag header to the optimized image response.
This does _not_ change the expireAt (TTL) for cached files on the server, which still uses the max-age of the upstream response.
The new file format on disk for cached image files is the following:
```
.next/cache/images/<HASHED_QUERYSTRING>/<EXPIREAT>.<ETAG>.<EXT>
```
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 29, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
When using the new Image Optimization feature, it appears as though even though Cache-Control is being set, the response headers aren't including what should be automatically generated.
Describe the bug
As an example for all my static images, I am adding cache-control.
e.g.
I can see in the response headers that the cache control is being added just fine. But pre using the new Image Optimization, my response headers looked like:
and now while using the new feature they look like.
The ETag and date last modified is missing...hmmmm.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Expected behavior
Expected behaviour is that the ETag and Last-Modified would be generated as they normally are when normal images are used, using the normal img tag.
System information
The text was updated successfully, but these errors were encountered: