Images not working in prod
Answered
Sloth bear posted this in #help-forum
Sloth bearOP
I am working with NextJS 14.
I have 2 images in
These images load perfectly fine in my local machine, but when I see them on the hosted site, the images don't work.
The images seem to be there as when i go to
I have 2 images in
/public directory.These images load perfectly fine in my local machine, but when I see them on the hosted site, the images don't work.
The images seem to be there as when i go to
mydomain.com/imageName.png it works.Answered by gin
this is cause the endpoint which should have been a image redirects to your loginpage
25 Replies
@Sloth bear I am working with NextJS 14.
I have 2 images in `/public` directory.
These images load perfectly fine in my local machine, but when I see them on the hosted site, the images don't work.
The images seem to be there as when i go to `mydomain.com/imageName.png` it works.
check for response in the console network tab
Sloth bearOP
it magically is working now.......weird
its been a thing since yesterday
its been a thing since yesterday
could have been in a weird cache issue
glad it works
Sloth bearOP
this is on edge
@Sloth bear this is on edge
this is cause the endpoint which should have been a image redirects to your loginpage
Answer
Sloth bearOP
o ya
gotit
thanks
ima try fixing that
👍
Sloth bearOP
ig yeh that fixed it
another quick question
isnt the matcher supposed to prevent this?
export const config = {
matcher: [
'/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',
],
}i have this in the file
@Sloth bear ts
export const config = {
matcher: [
'/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',
],
}
this basically matches everything
except /api/ or _next/static
but your image is hosted on domain.com/image.png so that will be matched
Sloth bearOP
ah i see
ok i added .png to it
ty for helping