Skip to content

Images generated by next/image not in optimized formats and have 301 redirect issue #687

Closed
@vxncetxn

Description

@vxncetxn

Describe the bug
Images generated by next/image 1) are not in optimized webp format despite using webp-compatible browsers (the resultant format is jpeg which is the original image format) and 2) have a strange 301 redirect issue. I tested this in the latest versions of Firefox, Chrome and Safari and error number 2 manifests slightly differently in each browser - in the worst case (Firefox), the transferred 301 file have the same size as the original image, leading to x2 KBs being transferred (and visually-apparent slowness in loading images) whereas in the best case (Safari), the 301 files seem to have 0Bs.

I also tested this both in localhost and in Vercel and none of the above two errors appear in those scenarios.

The image below shows both of these errors in Firefox browser:

firefox-error

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://marketing-proxy-two.netlify.app/
  2. Open Devtools
  3. Click on Network tab and click on Images to only see image resources
  4. Refresh and see errors as described above

Expected behavior
Images should be in optimized webp formats and should not have a 301 redirection as in the below image (which is from localhost).

firefox-correct

Versions

  • Next.js: v11.1.2
  • @netlify/plugin-nextjs: v3.9.0
  • @netlify/build: v18.13.12
  • node: v16.11.0
  • yarn: v1.22.10

If you're using the CLI to build

  • OS: [e.g. macOS, Windows] macOS Catalina Version 10.15.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions