question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support dynamic redirect destinations

See original GitHub issue

Is your feature request related to a problem? Please describe. As mentioned in the limitations, there isn’t built-in support for custom redirect destinations based on the user’s auth status. This limits the usefulness of the redirects.

Describe the solution you’d like and how you’d implement it Allow users to provide functions for the authPageURL and appPageURL config properties that should return the appropriate URL. We could pass either ctx or window to the function, depending on the context.

// ctx would be defined when server-side redirecting, window for client-side
({ ctx, window }) => {
  // some logic
  return '/my-auth-page?next=/my-app/'
}

Is this a breaking change? No. We would still support static values for the config options.

Describe alternatives you’ve considered None

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kmjennisoncommented, Jan 30, 2021

@tlays Thanks for the thoughtful feedback! I agree with all of your suggestions.

You mention it’s for the authPageURL and appPageURL config properties, but I assume it would also work for the option parameters of all withAuthXXX functions right ?

Yes

I believe it’s implied, but just for clarity, authPageURL and appPageURL could be provided either as string, or functions right ?

Yes

I’m not sure that passing window in parameters is a good idea.

I agree

Shouldn’t we expose the AuthUser also ?

I agree, this is a good idea

0reactions
kmjennisoncommented, Apr 7, 2021

Opened an issue to update the documentation and example: #122

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Dynamic Destination URL (DDU) works?
Dynamic Destination URL (DDU) allows you to redirect visitors to different destination URLs with the same tracking link by just adding a ...
Read more >
Dynamic URL redirects: 301 to the future
With Dynamic Redirects, users can redirect visitors to another webpage or website based upon hundreds of options such as the visitor's country ...
Read more >
Redirects that match dynamic change in source and ...
Redirects that match dynamic change in source and destination URL ... The problem is that we need to set a redirect that URL...
Read more >
WebHops and Redirects in Dynamic DNS | Dyn Help Center
Redirecting a Dynamic DNS (DynDNS Pro) host to a different location is a fairly simple process. ... select the WebHop Redirect option under...
Read more >
How can I increase the limit of redirects or use dynamic ...
In this article, we describe methods to redirect a path to another location by using Next.js and Vercel features. Using Serverless Functions or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found