image: IPX: Forbidden host: localhost

I am using @nuxt/image package to serve my images on my project. here is my package information

package.json file

"@nuxt/image": "^0.6.0",
 "nuxt": "^2.15.8",
"ipx": "^0.9.2",

nuxt.config.js

build:{
    '@nuxt/image',
},
image: {
      domains: ['http://localhost:8000']
},

as mentioned inside docs.

my nuxtjs projects is served on localhost:4000 and my backend which is in Laravel is served on localhost:8000 port number. when I try to get images from my server it returns

IPX: Forbidden host: localhost

Please help me

thank you

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 17 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Same with "@nuxt/image": "^0.6.2"

Thanks for providing reproduction @narduin. I’ve noticed the issue is that the port is being stripped from normalized domains but being checked later on in ipx because of hostname usage. I will work on an improvemet.

In the meantime, simplest fix is to drop the port from domains:

  image: {
    domains: ['localhost']
  },

Would you please provide a reproduction of your setup? 🙏🏼

I tried to create a simple reproduction here.
I hope it helps!