Next/image images are downloading twice. (301)

I was creating a Next.js website with @netlify/plugin-nextjs. I noticed that images are getting downloaded twice when hosted on Netlify with status 301.

An example of the Hero Image.

              alt="Hero Image"
1 Like

Hi @HenrikDK

A 301 is a redirect (see MDN) meaning the document requested is in a different location as seen in the screenshot below:

When you receive a 200, that is downloading the image

You are correct though, there is a difference on the Vercel version of your site as there are no 301 redirects.

Keep in mind, Netlify and Vercel are different platforms, with different approaches, and different underlying technologies.

I had the same thought after a google search, but it does still seem to download more. The images are first loaded when the 301 request are done fetching resulting in a bigger and slower site compared to Vercel that could impact SEO and Lightspeed results.

Peek 2021-10-21 23-43

As mentioned previously, a 301 is a redirect. The images are not downloaded when the status code returned is a 301.

I see, it’s just annoying that the browser is reporting that the website is much larger than it is.

Many things could impact the speed your browser reports. These include (but are not limited to) the distance from the CDN node you are connecting to, local network traffic, the available resources of your browser/computer (such as the speed, how many other tasks are running, how many browser tabs you have open, etc.)

Edit: I note you have now deleted both sites you originally linked to. Unfortunately this means no one else can test and provide any further assistance.