Skip to content
Snippets Groups Projects
Commit 892784a8 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Be graceful with the 'baseurlpath' configuration option. We should not fail...

Be graceful with the 'baseurlpath' configuration option. We should not fail when the trailing slash is missing, just add it.
parent b815965d
No related branches found
No related tags found
No related merge requests found
......@@ -454,9 +454,13 @@ class SimpleSAML_Configuration
return \SimpleSAML\Utils\HTTP::getFirstPathElement(false).$matches[1];
}
if (preg_match('#^https?://[^/]*/(.*)$#', $baseURL, $matches)) {
if (preg_match('#^https?://[^/]*(?:/(.+/?)?)?$#', $baseURL, $matches)) {
// we have a full url, we need to strip the path
return $matches[1];
if (!array_key_exists(1, $matches)) {
// root directory specified with an absolute URL
return '';
}
return rtrim($matches[1], '/')."/";
} elseif ($baseURL === '' || $baseURL === '/') {
// Root directory of site
return '';
......
......@@ -566,9 +566,9 @@ class HTTP
$globalConfig = \SimpleSAML_Configuration::getInstance();
$baseURL = $globalConfig->getString('baseurlpath', 'simplesaml/');
if (preg_match('#^https?://.*/$#D', $baseURL, $matches)) {
if (preg_match('#^https?://.*/?$#D', $baseURL, $matches)) {
// full URL in baseurlpath, override local server values
return $baseURL;
return rtrim($baseURL, '/').'/';
} elseif (
(preg_match('#^/?([^/]?.*/)$#D', $baseURL, $matches)) ||
(preg_match('#^\*(.*)/$#D', $baseURL, $matches)) ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment