diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php
index a71193e869da36af455e7930fe8f945bda81d4f7..ddb9285725d73824e4bf3263b489dae394ceb6a9 100644
--- a/lib/SimpleSAML/XHTML/IdPDisco.php
+++ b/lib/SimpleSAML/XHTML/IdPDisco.php
@@ -217,7 +217,7 @@ class SimpleSAML_XHTML_IdPDisco
             // we save the cookies for 90 days
             'lifetime' => (60 * 60 * 24 * 90),
             // the base path for cookies. This should be the installation directory for SimpleSAMLphp
-            'path'     => ('/'.$this->config->getBaseUrl()),
+            'path'     => $this->config->getBasePath(),
             'httponly' => false,
         );
 
diff --git a/modules/core/www/cleardiscochoices.php b/modules/core/www/cleardiscochoices.php
index a5616d84e2bdb0a1c49f4af4e1f6404ffa798c2f..3628a45315554190036520efccf551a8726480e8 100644
--- a/modules/core/www/cleardiscochoices.php
+++ b/modules/core/www/cleardiscochoices.php
@@ -8,7 +8,7 @@ require_once('_include.php');
 
 // The base path for cookies. This should be the installation directory for SimpleSAMLphp.
 $config = SimpleSAML_Configuration::getInstance();
-$cookiePath = '/' . $config->getBaseUrl();
+$cookiePath = $config->getBasePath();
 
 // We delete all cookies which starts with 'idpdisco_'
 foreach($_COOKIE as $cookieName => $value) {
diff --git a/modules/multiauth/lib/Auth/Source/MultiAuth.php b/modules/multiauth/lib/Auth/Source/MultiAuth.php
index dc0a95e3cc92dcbae767141db3a9333c95cc9be8..f3acc9016a432c44f7ab9e7c7daac5d6e20a1966 100644
--- a/modules/multiauth/lib/Auth/Source/MultiAuth.php
+++ b/modules/multiauth/lib/Auth/Source/MultiAuth.php
@@ -204,7 +204,7 @@ class sspmod_multiauth_Auth_Source_MultiAuth extends SimpleSAML_Auth_Source {
 			'lifetime' => (60*60*24*90),
 			/* The base path for cookies.
 			This should be the installation directory for SimpleSAMLphp. */
-			'path' => ('/' . $config->getBaseUrl()),
+			'path' => $config->getBasePath(),
 			'httponly' => FALSE,
 		);