diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php
index a422e624e142a2bb5ee3016717143c2a7b1f2e72..2c035bc7415782deb95931da13babcafe9ee13e9 100644
--- a/lib/SimpleSAML/Error/Error.php
+++ b/lib/SimpleSAML/Error/Error.php
@@ -265,7 +265,7 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception {
 		if($config->getBoolean('errorreporting', TRUE) &&
 			$config->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') {
 			/* Enable error reporting. */
-			$baseurl = SimpleSAML_Utilities::getBaseURL();
+			$baseurl = \SimpleSAML\Utils\HTTP::getBaseURL();
 			$data['errorReportAddress'] = $baseurl . 'errorreport.php';
 		}
 
diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php
index 22688c297bcc67acfcbf41ee971f038c37722e8e..b028bb4f877bb92f5c1e9a7bdd5b0bed7237af1a 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php
@@ -116,7 +116,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerFlatFile extends SimpleSAML_Meta
 	private function generateDynamicHostedEntityID($set) {
 
 		/* Get the configuration. */
-		$baseurl = SimpleSAML_Utilities::getBaseURL();
+		$baseurl = \SimpleSAML\Utils\HTTP::getBaseURL();
 
 		if ($set === 'saml20-idp-hosted') {
 			return $baseurl . 'saml2/idp/metadata.php';
diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php
index 829fa7b1182a2bf51c2d98d2ec2c7274bde11ebe..45b1ae6f539f44e08ea0c6e32ee6d120a1e9ad7f 100644
--- a/lib/SimpleSAML/Module.php
+++ b/lib/SimpleSAML/Module.php
@@ -155,7 +155,7 @@ class SimpleSAML_Module {
 		assert('is_string($resource)');
 		assert('$resource[0] !== "/"');
 
-		$url = SimpleSAML_Utilities::getBaseURL() . 'module.php/' . $resource;
+		$url = \SimpleSAML\Utils\HTTP::getBaseURL() . 'module.php/' . $resource;
 		if (!empty($parameters)) {
 			$url = \SimpleSAML\Utils\HTTP::addURLParameters($url, $parameters);
 		}
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 81d8a28e87976e63ab18fe4e5dd229ddeb7170ee..b592539d6c41d4ce322b32dfa791eea830a03c1c 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -208,46 +208,10 @@ class SimpleSAML_Utilities {
 
 
 	/**
-	 * Retrieve and return the absolute base URL for the simpleSAMLphp installation.
-	 *
-	 * For example: https://idp.example.org/simplesaml/
-	 *
-	 * The URL will always end with a '/'.
-	 *
-	 * @return string  The absolute base URL for the simpleSAMLphp installation.
+	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getBaseURL() instead.
 	 */
 	public static function getBaseURL() {
-
-		$globalConfig = SimpleSAML_Configuration::getInstance();
-		$baseURL = $globalConfig->getString('baseurlpath', 'simplesaml/');
-		
-		if (preg_match('#^https?://.*/$#D', $baseURL, $matches)) {
-			/* full URL in baseurlpath, override local server values */
-			return $baseURL;
-		} elseif (
-			(preg_match('#^/?([^/]?.*/)$#D', $baseURL, $matches)) ||
-			(preg_match('#^\*(.*)/$#D', $baseURL, $matches)) ||
-			($baseURL === '')) {
-			/* get server values */
-
-			if (self::getServerHTTPS()) {
-				$protocol = 'https://';
-			} else {
-				$protocol = 'http://';
-			}
-
-			$hostname = self::getServerHost();
-			$port = self::getServerPort();
-			$path = '/' . $globalConfig->getBaseURL();
-
-			return $protocol.$hostname.$port.$path;
-		} else {
-			throw new SimpleSAML_Error_Exception('Invalid value of \'baseurl\' in '.
-				'config.php. Valid format is in the form: '.
-				'[(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/]. '.
-				'It must end with a \'/\'.');
-		}
-
+		return \SimpleSAML\Utils\HTTP::getBaseURL();
 	}
 
 
diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php
index 5c504277cdeab9d6bdc43841def7a9bb0234854f..96577ff30bc7890baa414a0ad66de31bc8b6c4ba 100644
--- a/lib/SimpleSAML/Utils/HTTP.php
+++ b/lib/SimpleSAML/Utils/HTTP.php
@@ -207,6 +207,47 @@ class HTTP
     }
 
 
+    /**
+     * Retrieve the base URL of the SimpleSAMLphp installation. The URL will always end with a '/'. For example:
+     *      https://idp.example.org/simplesaml/
+     *
+     * @return string The absolute base URL for the simpleSAMLphp installation.
+     * @throws \SimpleSAML_Error_Exception If 'baseurlpath' has an invalid format.
+     *
+     * @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
+     */
+    public static function getBaseURL()
+    {
+        $globalConfig = \SimpleSAML_Configuration::getInstance();
+        $baseURL = $globalConfig->getString('baseurlpath', 'simplesaml/');
+
+        if (preg_match('#^https?://.*/$#D', $baseURL, $matches)) {
+            // full URL in baseurlpath, override local server values
+            return $baseURL;
+        } elseif (
+            (preg_match('#^/?([^/]?.*/)$#D', $baseURL, $matches)) ||
+            (preg_match('#^\*(.*)/$#D', $baseURL, $matches)) ||
+            ($baseURL === '')
+        ) {
+            // get server values
+            $protocol = 'http';
+            $protocol .= (self::getServerHTTPS()) ? 's' : '';
+            $protocol .= '://';
+
+            $hostname = self::getServerHost();
+            $port = self::getServerPort();
+            $path = '/'.$globalConfig->getBaseURL();
+
+            return $protocol.$hostname.$port.$path;
+        } else {
+            throw new \SimpleSAML_Error_Exception('Invalid value for \'baseurlpath\' in '.
+                'config.php. Valid format is in the form: '.
+                '[(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/]. '.
+                'It must end with a \'/\'.');
+        }
+    }
+
+
     /**
      * Parse a query string into an array.
      *
diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php
index a96e005ee9b044e9ff553eeb6e04e634b4fa5921..610f84baf39210639650fbb03af82f6a2ea4e258 100644
--- a/modules/adfs/lib/IdP/ADFS.php
+++ b/modules/adfs/lib/IdP/ADFS.php
@@ -168,7 +168,7 @@ class sspmod_adfs_IdP_ADFS {
 		// NB:: we don't know from which SP the logout request came from
 		$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 		$idpMetadata = $idp->getConfig();
-		SimpleSAML_Utilities::redirectTrustedURL($idpMetadata->getValue('redirect-after-logout', SimpleSAML_Utilities::getBaseURL()));
+		SimpleSAML_Utilities::redirectTrustedURL($idpMetadata->getValue('redirect-after-logout', \SimpleSAML\Utils\HTTP::getBaseURL()));
 	}
 	
 	public static function receiveLogoutMessage(SimpleSAML_IdP $idp) {
diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php
index 7e4cc4fe953d9839ff7494b7112733746bdf6646..e97eb4bb3fa99342dee0209ddf703208ec63c1d3 100644
--- a/modules/core/www/frontpage_config.php
+++ b/modules/core/www/frontpage_config.php
@@ -44,12 +44,12 @@ $links_federation = array();
 
 
 $links_config[] = array(
-	'href' => SimpleSAML_Utilities::getBaseURL() . 'admin/hostnames.php',
+	'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/hostnames.php',
 	'text' => '{core:frontpage:link_diagnostics}'
 );
 
 $links_config[] = array(
-	'href' => SimpleSAML_Utilities::getBaseURL() . 'admin/phpinfo.php',
+	'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/phpinfo.php',
 	'text' => '{core:frontpage:link_phpinfo}'
 );
 
diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php
index 5e32a10bd13e8f44bc2733a9addc1816ad4fd06c..aab31a56d2eb50d468c834ce2cc69c7dc393ea99 100644
--- a/modules/core/www/frontpage_federation.php
+++ b/modules/core/www/frontpage_federation.php
@@ -37,7 +37,7 @@ if($config->getBoolean('idpdisco.enableremember', FALSE)) {
 
 
 $links_federation[] = array(
-	'href' => SimpleSAML_Utilities::getBaseURL() . 'admin/metadata-converter.php',
+	'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/metadata-converter.php',
 	'text' => '{core:frontpage:link_xmlconvert}',
 );
 
diff --git a/www/admin/hostnames.php b/www/admin/hostnames.php
index 93b6180b8e7f074f6f23129d8ef7c25a301c5bf3..0a520a93ae97d7c0f084ffe783aaa57201443d83 100644
--- a/www/admin/hostnames.php
+++ b/www/admin/hostnames.php
@@ -16,7 +16,7 @@ $attributes['HTTPS'] = array($_SERVER['HTTPS']);
 $attributes['SERVER_PROTOCOL'] = array($_SERVER['SERVER_PROTOCOL']);
 $attributes['SERVER_PORT'] = array($_SERVER['SERVER_PORT']);
 
-$attributes['Utilities_getBaseURL()'] = array(SimpleSAML_Utilities::getBaseURL());
+$attributes['Utilities_getBaseURL()'] = array(\SimpleSAML\Utils\HTTP::getBaseURL());
 $attributes['Utilities_getSelfHost()'] = array(SimpleSAML_Utilities::getSelfHost());
 $attributes['Utilities_selfURLhost()'] = array(SimpleSAML_Utilities::selfURLhost());
 $attributes['Utilities_selfURLNoQuery()'] = array(SimpleSAML_Utilities::selfURLNoQuery());
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 67d56ca45b73ab05c012821fbdee34977bae305a..6f7377cfe88b6c27892d6649cf4f697b3cfd3270 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -105,7 +105,7 @@ try {
 		/* Artifact sending enabled. */
 		$metaArray['ArtifactResolutionService'][] = array(
 			'index' => 0,
-			'Location' => SimpleSAML_Utilities::getBaseURL() . 'saml2/idp/ArtifactResolutionService.php',
+			'Location' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'saml2/idp/ArtifactResolutionService.php',
 			'Binding' => SAML2_Const::BINDING_SOAP,
 		);
 	}
@@ -115,7 +115,7 @@ try {
 		array_unshift($metaArray['SingleSignOnService'], array(
 			'hoksso:ProtocolBinding' => SAML2_Const::BINDING_HTTP_REDIRECT,
 			'Binding' => SAML2_Const::BINDING_HOK_SSO,
-			'Location' => SimpleSAML_Utilities::getBaseURL() . 'saml2/idp/SSOService.php'));
+			'Location' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'saml2/idp/SSOService.php'));
 	}
 
 	$metaArray['NameIDFormat'] = $idpmeta->getString('NameIDFormat', 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient');