next/image Un-configured Host with IP domain

1.2k views Asked by At

i built site using NextJS and image is host at other dev server that run with IP. THe file is public accessible by the image path : http://xxx.xx.xxx.xxx:8080/storage/user-profile/61d41e2b05de9_WhatsApp%20Image%202022-01-02%20at%2021.46.03.jpeg But I receiving the following error: Error Message

I added following code to the next.config.js :

module.exports = {
  images: {
    domains: ["http://xxx.xx.xxx.xxx:8080"],
  },
};

even tried with

module.exports = {
  images: {
    domains: ["http://xxx.xx.xxx.xxx:8080"],
  },
};

both return the same error as shown in above screenshot

Any help is greatly appreciated

1

There are 1 answers

2
Jerson On BEST ANSWER

domains should not have http:// or https:// or the scheme included

You may use the hostname of your source image url

module.exports = {
  images: {
    domains: ['cdn.yoursite.com'],
  },
}