Next.js Discord

Discord Forum

Problems with assetsPrefix and Image Optimization

Unanswered
danim47c posted this in #help-forum
Open in Discord
I am deploying static assets in a CDN.

The problem is that when I set an assetsPrefix in the configuration, optimized images also include that prefix but default nextjs image optimizator returns 400.

This is the URL it's being fetched: http://localhost:3000/_next/image?url=%2Fassets%2F_next%2Fstatic%2Fmedia%2Fvalidation.6b141f05.png&w=640&q=75

The assets prefix I have set is /assets.

And the following error is shown:
 ⨯ The requested resource isn't a valid image for /assets/_next/static/media/validation.6b141f05.png received text/html; charset=utf-8

1 Reply

Thanks for anyone who can help me out!!!