Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(middleware): use
includes()
for NextAuth pages (#5104)
* fix(middleware): use `includes()` for NextAuth pages Some users could be setting their `signIn` and `error` pages option to `/` to disable the automatically generated pages, as suggested in [1]. This commit reverts the behaviour for matching `signIn` and `error` pages in `handleMiddleware` to pre-v4.10.3. ``` const signInPage = "/" const errorPage = "/" const publicPaths = [signInPage, errorPage, "/_next", "/favicon.ico"] // pathname = "/" will return true publicPaths.some((p) => pathname.startsWith(p)) ``` Fixes: aedabc8 ("fix: avoid redirect on always public paths") Reference [1]: #2330 (reply in thread) Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> * test(middleware): add tests for public paths Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Co-authored-by: Thang Vu <thvu@hey.com>
- Loading branch information