Skip to content

Infinite Redirect Loop When Home URL is current URL #2581

Description

@jeremysawesome

Preliminary Checks

Reproduction / Replay Link

https://gitlab.com/jeremysawesome/clerk-minimal-reproduction

Publishable key

pk_test_dG9nZXRoZXItZWdyZXQtMzUuY2xlcmsuYWNjb3VudHMuZGV2JA

Description

If the Home URL and the current url are the same, and there is a SignIn or SignUp component mounted on the page, then Clerk will infinitely redirect.

Here's a gif to illustrate

brave_Rvw0su1pU5

Steps to reproduce:

  1. Drop the index.html file into a directory where it can be accessed via browser
    (i.e. $DEVHOST/clerk-minimal-reproduction/).
  2. Adjust the script src and publishable key for your Clerk app.
  3. Navigate to Developers > Paths in your Clerk Dashboard
  4. Change your Application homepage to /clerk-minimal-reproduction/
  5. Do the same for all the User redirects in Configure > Account Portal > Redirects
  6. Log in or sign up for your application via $DEVHOST/clerk-minimal-reproduction/ in your browser.

Behold the redirect loop.

Expected behavior:

  1. Don't redirect to the same url (in the case where the Home URL and current URL are the same)
  2. Output a warning or error in the console if the preconditions fail.
  3. Don't render the components if the preconditions fail (i.e. the urls are the same).

Actual behavior:

Clerk initiates an infinite redirect loop. It's hard to find the reason why unless you are able to pause the page after the Clerk message appears in the console but before the page reloads.

Environment

Not necessary. This is a simple index.html page hosted at a publicly accessible url.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions