mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
fix: login return_url doesn't work with custom server paths (#21588)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
This commit is contained in:
parent
55aab6efb6
commit
eed70eed6e
2 changed files with 7 additions and 2 deletions
|
|
@ -235,7 +235,7 @@ export class App extends React.Component<
|
|||
}
|
||||
|
||||
public getChildContext() {
|
||||
return {history, apis: {popup: this.popupManager, notifications: this.notificationsManager, navigation: this.navigationManager}};
|
||||
return {history, apis: {popup: this.popupManager, notifications: this.notificationsManager, navigation: this.navigationManager, baseHref: base}};
|
||||
}
|
||||
|
||||
private async subscribeUnauthorized() {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,12 @@ export class Login extends React.Component<RouteComponentProps<{}>, State> {
|
|||
this.setState({loginInProgress: false});
|
||||
if (returnURL) {
|
||||
const url = new URL(returnURL);
|
||||
this.appContext.apis.navigation.goto(url.pathname + url.search);
|
||||
let redirectURL = url.pathname + url.search;
|
||||
// return url already contains baseHref, so we need to remove it
|
||||
if (this.appContext.apis.baseHref != '/' && redirectURL.startsWith(this.appContext.apis.baseHref)) {
|
||||
redirectURL = redirectURL.substring(this.appContext.apis.baseHref.length);
|
||||
}
|
||||
this.appContext.apis.navigation.goto(redirectURL);
|
||||
} else {
|
||||
this.appContext.apis.navigation.goto('/applications');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue