Incompatibility with next.js redirects
See original GitHub issueIssue
If redirects are configured in a next config the sessions don’t seem to make it into session storage, which results in a redirect back to login, which then redirects back to the app - this cycle happens indefinitely.
Steps to reproduce:
-
Add a new route file (e.g.,
test.js
) -
Configure a redirect in a next.js config file (e.g., in a
next.config.js
file in the root directory):
/** @type {import('next').NextConfig} */
const nextConfig = {
async redirects() {
return [
{
source: '/',
destination: '/test',
permanent: false,
},
]
},
}
module.exports = nextConfig
Versions
- react-oidc v6.5.7
- next v12.2.5
- react v18.2.0
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
next.config.js: Redirects
Redirects allow you to redirect an incoming request path to a different destination path. To use Redirects you can use the redirects key...
Read more >React Next js app redirect to login is premature - Stack Overflow
The problem is when a user is logged in and directly goes to /user/dashboard route, for a split second, user is undefined may...
Read more >How to implement redirects in Next.js - LogRocket Blog
Redirects enable users to transfer an executed URL to a new URL to reroute an incoming request from one path to another.
Read more >Capture group in redirect source causes Uncaught SyntaxError
Add a new redirect to your next.config.js as follows: { source: '/:path((?!incompatible).*)', destination: '/incompatible', permanent: false ...
Read more >Duplicate content and no default Next JS redirect from trailing ...
I have deployed next.js 11.1.0 test site and noticed that the redirect from trailing slash is not functional. Both URLs load creating duplicate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@guillaume-chervet - Yes, absolutely! Sorry, I should have added that in the last message.
Thank you very much @madze