'How to load images from custom domains to next.config.js for "next/image"/
I have two hostings, one is running nextjs on the domen.com. On the second img.domain.com.
And i use <Image src='img.domain.com/test.png' width="200" height="50" />
I get the error:
FetchError: request to https://img.domain.com/test.png failed, reason: read ECONNRESET
Beacuse, if i open via a direct link, then the pictures open, but with the parameters &w=1200&q=75 they do not open. Nging get the error 404 Not Found
next.config.js
module.exports = {
images: {
domains: ['img.domain.com']
},
}
Solution 1:[1]
You need to use the full domain inside the src attribute. Something like the following
<Image src='https://img.domain.com/test.png' width="200" height="50" />
Hope this helps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pranta |
