Image from /api/imageProxy
Answered
Persian posted this in #help-forum
PersianOP
Hi, I am trying to implement api to load images in next14 project. The proxy itself works fine. Unfortunately next/image do no want to load images from /api/imageProxy... url. I am getting error 400 bad request and "unable to optimise image and unable to fallback to upstream". What I am missing?
Answered by Persian
Thank you for your reply. I found a problem. Apparently I had trailingSlash:true in next.config.js. That changed the image url from /api/imageProxy?imageUrl= to /api/imageProxy/?imageUrl= ... For API that was not an issue but next/image did not like it 🙂
3 Replies
@Persian Hi, I am trying to implement api to load images in next14 project. The proxy itself works fine. Unfortunately next/image do no want to load images from /api/imageProxy... url. I am getting error 400 bad request and "unable to optimise image and unable to fallback to upstream". What I am missing?
could you show the code on
/api/imageProxy?PersianOP
Thank you for your reply. I found a problem. Apparently I had trailingSlash:true in next.config.js. That changed the image url from /api/imageProxy?imageUrl= to /api/imageProxy/?imageUrl= ... For API that was not an issue but next/image did not like it 🙂
Answer