NextJS Image caching problem
Answered
Idra posted this in #help-forum
IdraOP
Hello everyone!
I discovered a bug/problem about nextjs image caching. Basically, if i replace an image keeping the same name as the old image, the website won't recognize the file change, as a result, nextjs will show (even i re-build the whole website and delete the .next folder) the same old image.
I Didn't know about this bug/problem until now, if someone can please help me replacing an image updating it in the website, without changing its name it would be really helpful, thanks in advance!
I discovered a bug/problem about nextjs image caching. Basically, if i replace an image keeping the same name as the old image, the website won't recognize the file change, as a result, nextjs will show (even i re-build the whole website and delete the .next folder) the same old image.
I Didn't know about this bug/problem until now, if someone can please help me replacing an image updating it in the website, without changing its name it would be really helpful, thanks in advance!
Answered by Idra
Alright, problem solved.
Basically, it's a browser cache problem, even if you reset the cookies, you'll need to wait for the correct images to get shown.
Basically, it's a browser cache problem, even if you reset the cookies, you'll need to wait for the correct images to get shown.
4 Replies
English Lop
https://nextjs.org/docs/pages/api-reference/components/image#caching-behavior <-- here's the default cachin strategy of the next/image component
English Lop
The browser is caching this request. Have you cleared your browser cache? You can do this by opening developer tools (Inspect) --> Network and look for disable cache. Refresh the page.
@English Lop The browser is caching this request. Have you cleared your browser cache? You can do this by opening developer tools (Inspect) --> Network and look for disable cache. Refresh the page.
IdraOP
i tried resetting my browser cache as well as other user's but the problem still occurs
IdraOP
Alright, problem solved.
Basically, it's a browser cache problem, even if you reset the cookies, you'll need to wait for the correct images to get shown.
Basically, it's a browser cache problem, even if you reset the cookies, you'll need to wait for the correct images to get shown.
Answer