-
Notifications
You must be signed in to change notification settings - Fork 29k
Description
What version of Next.js are you using?
10.0.2
What version of Node.js are you using?
12.4.1
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
Other platform
Describe the Bug
When trailingSlash is set to 'true' the /_next/image directory used for serving optimized images is also affected.
Instead of requesting the resource on:
/_next/image?url=/uploads/...
the user is redirected with 308 to
/_next/image/?url=/uploads/...
This creates a huge amount of unnecessary redirects for a page full of images. I couldn't find any additional config options for the trailingSlash option whatsoever.
Expected Behavior
The optimized images path to not be redirected to a path with a trailing slash.
To Reproduce
- Create a NextJS application.
- Add a couple of next/image images.
- Set trailingSlash to true.
- Check the network tab and verify that the requests for the images have been redirected with status code 308.
- Disable trailingSlash and verify that there are no redirects.