Skip to content

How to customize the caching key of next/image? #31601

Closed Answered by leerob
frankdilo asked this question in Help
Discussion options

You must be logged in to vote

You can now use minimumCacheTTL to change the cache-control:

module.exports = {
  images: {
    minimumCacheTTL: 60,
  },
}

And images.remotePatterns.search to filter on query strings or disallow all:

module.exports = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'example.com',
        port: '',
        pathname: '/account123/**',
        search: '',
      },
    ],
  },
}

Replies: 11 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@lelabo-m
Comment options

@sneko
Comment options

@camnewnham
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jackeverydayzero
Comment options

Comment options

You must be logged in to vote
2 replies
@goodok21
Comment options

@leerob
Comment options

Answer selected by leerob
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet