Skip to content
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

redirects in next config different from version before and produce endless redirect loops #64963

Open
philipheinser opened this issue Apr 24, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@philipheinser
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/cocky-frost-dsd496

To Reproduce

  1. add this to config
    async redirects() { return [ { source: '/app', destination: '/app/', permanent: false, }, ] }

  2. open /app and see your browser freeze or stop at some point do to endless redirects.

Current vs. Expected behavior

Above example should redirect normally from /app to /app/, bur redirect loop happens instead

Redirect loop happens in redirect in new Version > 13.4.19. without our code changes from previous versions

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 21.7.3
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 14.2.2 // Latest available version is detected (14.2.2).
  eslint-config-next: 14.2.2
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

I tested with the latest canary and still happens

@philipheinser philipheinser added the bug Issue was opened via the bug report template. label Apr 24, 2024
@github-actions github-actions bot added the Runtime Related to Node.js or Edge Runtime with Next.js. label Apr 24, 2024
@kyle-haining
Copy link

By default, Next.js redirects a url with a trailing slash to one without it:
https://nextjs.org/docs/app/api-reference/next-config-js/trailingSlash

You probably want to turn this option off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants