You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a few places in the admin UI where you might get caught by overzealous redirects. When this happens, it becomes impossible to go back to the previous page.
I have identified the folllowing two places where it can happen:
The login screen, especially when you get redirected.
The projects screen if you get redirected there from the root (pro, enterprise) or the default project when you are redirected from the root (open source)
Steps to reproduce the bug
For the login screen, the easiest I've found to replicate this reliably is to
log into Unleash
Navigate to a project's page.
Log out
Now try the navigating to the previous history item and notice that you get redirected to the login page.
Bonus! In another tab, navigate to the unleash instance's root, e.g. https://sandbox.getunleash.io/demo2
Notice that you get redirected to the login page and that you can't return to where you were previously
The projects screen is similar:
Ensure you're logged into the Unleash instance
Navigate to the Unleash instance's root (e.g.https://sandbox.getunleash.io/demo2) from any web page.
Notice you're redirected to /projects (pro, enterprise) or to the default project (open source).
Try to go back: notice you're stuck (I have actually managed to break out of the open source loop after enough tries, but I'm not sure why)
Expected behavior
I expect that the redirect is "invisible" and not added to the history.
When navigating from an unrelated page to Unleash (such as from github.com), I expect the back button to take me back the previous web page.
When navigating from inside Unleash to the root (when you get redirected to /projects or /projects/default), I expect to be taken to the previous page I was visiting.
When navigating back in history after logging out, I expect to be able to go one step at a time. So if I try to navigate back across 6 pages that require logging in to see, I should be able to press "back" 6 times, each time getting a different redirect URL for the login screen.
We use React Router for navigation purposes, and it seems (from the React Router Navigate docs) that the replace property should take care of this for us.
I've done some preliminary work on this and it seems that the frontend/src/component/common/LoginRedirect/LoginRedirect.tsx component is triggered (at least for the login redirects). That component does use the replace property, so that doesn't seem to be the cause.
I suspect there may be some interplay between the login redirect and the projects redirect that causes this loop, but I can't be sure.
ivarconr
changed the title
Overzealous redirects prevent navigating to previous history items
fix: Overzealous redirects prevent navigating to previous history items
Jan 19, 2023
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug
There's a few places in the admin UI where you might get caught by overzealous redirects. When this happens, it becomes impossible to go back to the previous page.
I have identified the folllowing two places where it can happen:
Steps to reproduce the bug
For the login screen, the easiest I've found to replicate this reliably is to
https://sandbox.getunleash.io/demo2
The projects screen is similar:
https://sandbox.getunleash.io/demo2
) from any web page./projects
(pro, enterprise) or to the default project (open source).Expected behavior
I expect that the redirect is "invisible" and not added to the history.
When navigating from an unrelated page to Unleash (such as from github.com), I expect the back button to take me back the previous web page.
When navigating from inside Unleash to the root (when you get redirected to
/projects
or/projects/default
), I expect to be taken to the previous page I was visiting.When navigating back in history after logging out, I expect to be able to go one step at a time. So if I try to navigate back across 6 pages that require logging in to see, I should be able to press "back" 6 times, each time getting a different redirect URL for the login screen.
Logs, error output, etc.
No response
Screenshots
Loom video for the login screen: https://www.loom.com/share/1dd44c2866e349eb87010c5ddb00c432
Loom video for the projects screen: https://www.loom.com/share/110fe359692445bea9a509d327ab61c0
Additional context
It seems likely that this may be caused by a wrongful use of the history API and a call to
pushState
instead ofreplaceState
.We use React Router for navigation purposes, and it seems (from the React Router
Navigate
docs) that thereplace
property should take care of this for us.I've done some preliminary work on this and it seems that the
frontend/src/component/common/LoginRedirect/LoginRedirect.tsx
component is triggered (at least for the login redirects). That component does use thereplace
property, so that doesn't seem to be the cause.I suspect there may be some interplay between the login redirect and the projects redirect that causes this loop, but I can't be sure.
Unleash version
commit hash: 6b5e25b
Subscription type
None
Hosting type
None
SDK information (language and version)
No response
The text was updated successfully, but these errors were encountered: