Skip to content

[BUG] trailingSlash redirecting doesn't work (app-router-e2e) #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dario-piotrowicz opened this issue Jan 31, 2025 · 0 comments · Fixed by #329
Closed

[BUG] trailingSlash redirecting doesn't work (app-router-e2e) #312

dario-piotrowicz opened this issue Jan 31, 2025 · 0 comments · Fixed by #329
Labels
bug Something isn't working

Comments

@dario-piotrowicz
Copy link
Contributor

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

@dario-piotrowicz dario-piotrowicz added bug Something isn't working triage labels Jan 31, 2025
@dario-piotrowicz dario-piotrowicz changed the title [BUG] trailingSlash redirecting doesn't work [BUG] trailingSlash redirecting doesn't work (app-router-e2e) Jan 31, 2025
@vicb vicb removed the triage label Feb 1, 2025
vicb added a commit that referenced this issue Feb 3, 2025
vicb added a commit that referenced this issue Feb 3, 2025
@vicb vicb closed this as completed in #329 Feb 3, 2025
@vicb vicb closed this as completed in 714172d Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants