IPX error 404's serving images through NGINX on SSR site
See original GitHub issue- I setup NGINX in proxy mode with the exact config file as described here (first snippet of code, with my own domain name in the
server_name
field). - Nuxt runs in SSR mode (not static).
"@nuxt/image": "^0.7.0"
is added in the dependencies inpackage.json
.- I also explicitly included
"ipx": "^0.9.11"
inpackage.json
. - All images in my project are located in (the default)
/static/img
so I have not setup the custom serverMiddleware (I tried that too, but that didn’t work either, BTW), as describe here.
Now when I open my project in a browser through my domain name, all loads fine except the images with the nuxt-image
tag that are to be served through IPX. All of them keep returning “404 Not Found”. The request are made to <my domain>/_ipx/img/base/logo.png
, for instance. All works fine on my development machine.
What am I missing? I thought it might have something to do with my NGINX config, but when I request time image URL with CURL directly on the server itself with curl -v "http://localhost:3000/_ipx/img/base/logo.png"
I also get a 404.
Update: I also tried by simply running the Nuxt app on my local machine in production mode and then the IPX requests fail as well.
(BTW, I also tried a deployment as a Digital Ocean App, exactly as described here but that exhibits the exact same problem).
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:14
I have the same issue, none of my images work with nuxt-img, here is example
<nuxt-img loading="lazy" class="w-80 inline-block max-w-full max-h-full" src="~assets/images/about/pub1.svg" alt="" />
it returns 404 for dev and in production.Ok, I found a workaround: I’m now using the free tier of imgix.com, following this guide. Extremely silly that I need to go through an external provider to get the images of my production server, but it works. I still hope this gets fixed very soon so that IPX works in production mode, just like it works in development mode.