Description
Describe the bug
By default Next.js will redirect URLs with trailing slashes to their counterpart without a trailing slash (Next.js docs) this however doesn't seem to happen in built-applications
Steps to reproduce
In any application using the adapter, start the next dev
server and navigate to any of the application's route, but with an added trailing slash (e.g. http://localhost:3000/api/hello/
) notice that the browser got redirected to the route without the trailing slash (e.g. http://localhost:3000/api/hello
)
Now build the application using the adapter and preview the application via wrangler dev
, following the process above will show that in such case the redirection does not happen (e.g. you navigate to http://localhost:8770/api/hello/
that route is served without being redirected to http://localhost:8770/api/hello
)
Expected behavior
URLs ending with /
should be redirected to their counterpart without the /
, unless trailingSlash
is set to true
in the Next.js config file, in that case the opposite should happen (routes not ending with /
should be redirected to ones ending with it)
@opennextjs/cloudflare version
0.4.3
Wrangler version
3.107.0
next info output
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.2.0: Fri Dec 6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 20.11.0
npm: 10.2.4
Yarn: 1.22.19
pnpm: 9.12.1
Relevant Packages:
next: 15.1.0 // There is a newer version (15.1.6) available, upgrade recommended!
eslint-config-next: 15.0.4
react: 19.0.0
react-dom: 19.0.0
typescript: 5.7.3
Next.js Config:
output: standalone
⚠ There is a newer version (15.1.6) available, upgrade recommended!
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
Additional context
No response