Nextjs: ipx images 403 forbidden after upgrading netlify/plugin-nextjs from 3.x to 4.x

After upgrading from netlify/plugin-nextjs from 3.x to 4.x, some of our images now fail with a 403 forbidden response code.

Four images being served up by netlify’s ipx feature will fail with 403 forbidden. Their domains are whitelisted in our application’s config through the “domains” property.

Same version using 3.x where the images successfully load:

Thanks!

Hi @wildabeast welcome to the forums! Did you declare the NEXT_IMAGE_ALLOWED_DOMAINS in the netlify.toml

What’s your next.config.js?

I have not declared NEXT_IMAGE_ALLOWED_DOMAINS – should it be?

images portion of next.config.js:

    images: {
      formats: ["image/webp"],
      disableStaticImages: true,
      remotePatterns: [
        {
          protocol: 'https',
          hostname: '**.netlify.app',
        },
        {
          protocol: 'https',
          hostname: '**.amazonaws.com',
        },
        {
          protocol: 'https',
          hostname: '**.goodfriend.com',
        },
        {
          protocol: 'https',
          hostname: '**.herokuapp.com',
        },
        {
          protocol: 'https',
          hostname: '**.ctfassets.net',
        },
        {
          protocol: 'https',
          hostname: 'localhost',
        },
        {
          protocol: 'https',
          hostname: '127.0.0.1',
        },
        {
          protocol: 'https',
          hostname: '**.netlify.app',
        },
      ],
    }

(also tried using the domains) feature

Also noted that the docs indicate that unwhitelisted urls will return a 400 not a 403, which suggests it isn’t a domain whitelisting issue?

Thanks

Which of your images are failing exactly? I visited the first URL and don’t see any broken images.