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

fix(middleware): use includes() for NextAuth pages #5104

Merged
merged 3 commits into from Sep 18, 2022
Merged

fix(middleware): use includes() for NextAuth pages #5104

merged 3 commits into from Sep 18, 2022

Commits on Sep 16, 2022

  1. 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>
    Juneezee committed Sep 16, 2022
    Copy the full SHA
    de836d2 View commit details
    Browse the repository at this point in the history
  2. test(middleware): add tests for public paths

    Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
    Juneezee committed Sep 16, 2022
    Copy the full SHA
    3356bcc View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2022

  1. Copy the full SHA
    d6a1ec6 View commit details
    Browse the repository at this point in the history