Redirect user on logout to login page of the same app

We have a Shiny Server Pro setup in-house with a variety of different apps being hosted. When the user connect to the base URL or the URL of a specific app, they are asked to login via via the built-in authentication in shiny server pro (authenticating via auth_active_dir). However when they logout of an app they are always redirected back to the base URL of the Shiny Server. So for example after logging out of the app located at 'https://appsite.company.com/app1' they are redirected to the login page at 'https://appsite.company.com'.

Is there any way to control where the logout button redirects the user after logging them out? Ideally we would like the user to be redirected the the login page for the same app that they just logged out from.

The code for our logout button looks like this:

tags$a(
        class = "btn btn-primary",
        href = "__logout__",
        role = "button",
        "Sign out"
      )

I hope that you can help with a solution :slight_smile:

One possibility: modify the configuration file so that each app directory is served at its own location, as below:

# Define a server that listens on port 3838
server {
  listen 3838;

  location /app1 {

    required_user *;
    app_dir /srv/shiny-server/app1;
  }

  location /app2 {

    required_user *;
    app_dir /srv/shiny-server/app2;
  }
}

Hitting the logout button on app1 will return you /app1 rather than the server root.

Unfortunately this doesn't seem to work - can it be because we're using a location with directory_index?

Our Shiny Server config file looks like so:

server {
  listen 3838 0.0.0.0;

  #Serve index for navigating between apps
  location / {
    site_dir /srv/shiny-server/index;
    log_dir /var/log/shiny-server/index;
    directory_index on;
    required_user *;
  }

  #Apps
  location /app1{
    app_dir /srv/shiny-server/prod/app1;
    log_dir /var/log/shiny-server/app1;
    required_user *;
  }

  location /app2{
    app_dir /srv/shiny-server/prod/app2;
    log_dir /var/log/shiny-server/app2;
    required_user *;
  }
}

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.