Idle logout sends back to wrong url

Our foreman is accessible to the following url : https://myforeman.mydomain/foreman

After using a session, the idle session is automatically close and the browser is sent back to the login back.
Unfortunately, instead of sending back to
https://myforeman.mydomain/foreman/user/login
it sends back to
https://myforeman.mydomain/user/login

I wonder how to fix this missing prefix. (the foreman_url is correctly set to https://myforeman.mydomain/foreman of course).

This sounds like a bug to me, please report it on https://projects.theforeman.org

Created as issue #23743

Notice that if this is too annoying for the time being, you can set the URL we redirect to after logout.

In Foreman, go to Administer > Settings, tab “Authentication”. Change the “Login delegation logout URL” option to “https://myforeman.mydomain/foreman”.

This option was meant for people who use Foreman and single-sign-on to redirect to single-sign-out, but it sounds like it could work around your problem.

1 Like

Issue is still there and noone looked Ă  this issue.
I found that redirection happens in the webpack javascript compiled in the /var/lib/foreman/public/bundle-.js.
Here’s the extract:

function onGetNotificationsSuccess({ data }) {
  dispatch({
    type: NOTIFICATIONS_GET_NOTIFICATIONS,
    payload: {
      notifications: data.notifications,
    },
  });
}
function onGetNotificationsFailed(error) {
  if (error.response.status === 401) {
    **window.location.replace('/users/login');**
  }
}

It should include the prefix.
Since 1.20, a few other url are missing the prefix in the menu
/locations
/locations/clear
/organizations
/organizations/clear

We generally assume foreman is installed as the root url, but perhaps it would be simple enough for @ui_ux team to generate urls relative to the foreman_url settings?

We have helpers for that. IMHO any UI reviewer should spot this and get the developer to fix this before we merge it.

It looks like the code already has quite a few of these bugs.

So, is it a bug ?
Shall I complete the issue in projects ?
How can I workaround this problem ?
Does an assets:compile solve the problem or not ?

Looks like a bug to me. It should be simple enough to use the foreman_url() function mentioned above (or better yet, implement something similar in react).