Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPX: Forbidden host: localhost #486

Closed
mohsenMJ opened this issue Feb 13, 2022 · 17 comments
Closed

IPX: Forbidden host: localhost #486

mohsenMJ opened this issue Feb 13, 2022 · 17 comments
Labels
bug Something isn't working workaround available

Comments

@mohsenMJ
Copy link

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

@AntoineAA
Copy link

Hi,
Same error here, using "@nuxt/image": "^0.6.1".

Best regards,
AA

@narduin

This comment was marked as duplicate.

@julioglobal100

This comment was marked as duplicate.

@alejosky

This comment was marked as duplicate.

@makadiwa

This comment was marked as off-topic.

@pi0
Copy link
Member

pi0 commented Jun 21, 2022

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

@makadiwa
Copy link

makadiwa commented Jun 21, 2022

Hi,

  • Install "npm up @nuxt/image"
  • Add the module to buildModules in your nuxt.config
    buildModules: [
    '@nuxt/image',
    ]
  • Added "nuxt-img src="/images1.jpeg"" in my view file

@filippodicostanzo

This comment was marked as duplicate.

@narduin
Copy link

narduin commented Jun 21, 2022

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

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

@pi0
Copy link
Member

pi0 commented Jun 21, 2022

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']
  },

@pi0 pi0 added bug Something isn't working workaround available and removed needs reproduction labels Jun 21, 2022
@narduin
Copy link

narduin commented Jun 21, 2022

Thanks @pi0, I can't believe I did not try that…

@makadiwa
Copy link

makadiwa commented Jun 22, 2022

@narduin Thanks for the reply, I tried your solution but still I get forbidden error at nuxt-img src="/oui.jpg" />, however adding localhost to the src ( nuxt-img src="http://localhost:3003/oui-express.jpg" />) works.

@pi0 I tried your suggestion as well but that doesn't work for me

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

@pi0 pi0 closed this as completed in 9f53d28 Jun 22, 2022
@pi0
Copy link
Member

pi0 commented Jun 22, 2022

@makadiwa Do you also get "Forbidden Host" error by removing port from config?

@makadiwa
Copy link

@pi0 I'm getting Forbidden path error after removing port from config.

Failed to load resource: the server responded with a status of 403 (IPX: Forbidden path)

@sa-rang
Copy link

sa-rang commented Jun 23, 2022

GET http://localhost:3006/_ipx/s_328x224/homepage/apple.png 403 (IPX: Forbidden path)

@pi0
Copy link
Member

pi0 commented Jun 23, 2022

Can you please try with 0.7.1 and fresh lock? If issue persists, would be happy to reopen and track.

procrates pushed a commit to procrates/nuxt-image that referenced this issue Feb 21, 2023
@Ahrorbek7
Copy link

Ahrorbek7 commented Sep 27, 2023

Error while using nuxt-img 0.7.1:
Failed to load resource: the server responded with a status of 404 (Not Found)

nuxt.config:
buildModules: ["@nuxtjs/tailwindcss","@nuxt/image",],
image: {
domains: ['localhost']
},
usage:

package.json:
"@nuxt/image": "^0.7.1",
"nuxt": "^2.15.7",
"ipx": "^1.3.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround available
Projects
None yet
Development

No branches or pull requests

10 participants