next-runtime icon indicating copy to clipboard operation
next-runtime copied to clipboard

[Bug]: Issue with trailingSlash: true not working in recent version of the plugin

Open MelvinPeepers opened this issue 3 years ago • 4 comments

Summary

Have an issue with trailing slashes not working on Netlify when using trailingSlash: true in the next.config.js file. When visiting /test it doesn't redirect to /test/ . Tested on both version 4.1.0 and 4.2.0 of netlify-plugin-nextjs.

Steps to reproduce

In the next.config.js file:

module.exports = {
  reactStrictMode: true,
  trailingSlash: true,
}

Site with version 4.1.0. Visit site, add /test to the url. GitHub repo of site.

Site with version 4.2.0 of the plugin. Visit site, add /test to the url. GitHub repo

A link to a reproduction repository

https://github.com/MelvinPeepers/next_trailing_slash

Plugin version

4.2.0

More information about your build

  • [ ] I am building using the CLI
  • [ ] I am building using file-based configuration (netlify.toml)

What OS are you using?

No response

Your netlify.toml file

`netlify.toml`
# Paste content of your `netlify.toml` file here

Your public/_redirects file

`_redirects`
# Paste content of your `_redirects` file here

Your next.config.js file

`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.

MelvinPeepers avatar Jan 20 '22 18:01 MelvinPeepers

@MelvinPeepers is this a regression? If so, do you have a repro where it does work?

ascorbic avatar Jan 21 '22 11:01 ascorbic

I don't get the read that the customer has seen it work before; seems they are porting their wordpress site to next.js. I have asked them to confirm that it isn't something they've had working here before and if so which version of the plugin it was with.

nolessafool avatar Jan 22 '22 00:01 nolessafool

I don't think this is possible, because these are static HTML files. It works with dynamic pages, but it doesn't work with static pages that are served from the CDN. The workaround is to make them ISR, with a long timeout (but under a year).

ascorbic avatar Jan 22 '22 06:01 ascorbic

I'm also having this issue with my site! Weird thing is that it's working when using netlify dev locally.

scajal avatar Apr 21 '22 13:04 scajal

Was someone able to fix it?

hk86 avatar Feb 06 '23 11:02 hk86

Closing as duplicate, will be solved in #1448

sarahetter avatar Apr 24 '23 15:04 sarahetter