diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index 56f5be402a934d52db63c4fe99b2066314b40fbd..44b4ab9718b0316a2f8de75b975126063c1051b7 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -64,6 +64,9 @@ defaultModule   = Search
 ; The base VuFind URL will load the "Home" action of this module when the user
 ; is logged in:
 defaultLoggedInModule = MyResearch
+; The route VuFind will send users to following a log out operation. Set to false
+; or omit to attempt to retain the user's current context after log out.
+;logOutRoute = home
 ; This tab will show by default when a record is viewed:
 defaultRecordTab= Holdings
 ; Hide the holdings tab if no holdings are available from the ILS
diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index 218d2868396c3c70fa380009e32d82ad10347c65..d30bc3aab1fba56f8a50c1c3428c321a9adf52d7 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -257,13 +257,18 @@ class MyResearchController extends AbstractBase
      */
     public function logoutAction()
     {
-        $logoutTarget = $this->getRequest()->getServer()->get('HTTP_REFERER');
-        if (empty($logoutTarget)) {
-            $logoutTarget = $this->getServerUrl('home');
-        }
+        $config = $this->getConfig();
+        if (isset($config->Site->logOutRoute)) {
+            $logoutTarget = $this->getServerUrl($config->Site->logOutRoute);
+        } else {
+            $logoutTarget = $this->getRequest()->getServer()->get('HTTP_REFERER');
+            if (empty($logoutTarget)) {
+                $logoutTarget = $this->getServerUrl('home');
+            }
 
-        // clear querystring parameters
-        $logoutTarget = preg_replace('/\?.*/', '', $logoutTarget);
+            // clear querystring parameters
+            $logoutTarget = preg_replace('/\?.*/', '', $logoutTarget);
+        }
 
         return $this->redirect()
             ->toUrl($this->getAuthManager()->logout($logoutTarget));