I am using next.js for the frontend of my blockchain application and am using IPFS to store my images. Whenever I try to display an image with the Image component, it shows hostname not configured error. I know how to configure a hostname by editing the next.config.js file but I don't want to manually do that everytime I add another image. Is there a way to automatically configure all hostnames?
Asked
Active
Viewed 1,349 times
1 Answers
0
I posted an answer here for the same question
how to allow all domains for Image nextjs config
There isn't an easy way to do this when you have an application that aggregates content from different sources and those sources link to different image domains.
The best way is to use an intermediary that fetches the images and configure its domain (e.g: yourproxy.com/fetch?image=<externalurl>
and then your proxy.com becomes a pass through, you can even write your own if you so wish

Ramakay
- 2,919
- 1
- 5
- 21