diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index 20e73551..3a2bc2c4 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -86,9 +86,16 @@ api_base_url = "http://127.0.0.1" ; https://${SERVER_NAME}/svn. ; You may specify multiple URLs separated with a comma as shown below: ; "http://${SERVER_NAME}/svn, https://${SERVER_NAME}/svn" -; REQUEST_PROTOCOL is resolved to either http or https. +; All specified URLs are shown in the repository list of the project overview +; page. +; You may use various items available in $_SERVER when composing the URL. +; For example, ${HTTP_HOST} maps to $_SERVER{'HTTP_HOST'}. +; Additionally, $_SERVER{'REQUEST_PROTOCOL'} added by config/config.php +; can be referenced with ${REQUEST_PROTOCOL} and it is resolved to either +; http or https. ;------------------------------------------------------------------------------ -svn_base_url = "${REQUEST_PROTOCOL}://${SERVER_NAME}:${SERVER_PORT}/svn" +;svn_base_url = "${REQUEST_PROTOCOL}://${SERVER_NAME}:${SERVER_PORT}/svn" +svn_base_url = "${REQUEST_PROTOCOL}://${HTTP_HOST}/svn" ;------------------------------------------------------------------------------ ; Login model to use. diff --git a/codepot/src/codepot/config/config.php b/codepot/src/codepot/config/config.php index d69f6b0c..dd4c70e8 100644 --- a/codepot/src/codepot/config/config.php +++ b/codepot/src/codepot/config/config.php @@ -17,17 +17,25 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { /* set to https if the first X-Forwarded-Proto is https */ if (array_search ("https", array_map ('strtolower', preg_split("/[\s,]+/", $_SERVER['HTTP_X_FORWARDED_PROTO']))) === 0) + { $config['base_url'] = 'https'; + $_SERVER['REQUEST_PROTOCOL'] = 'https'; + } else + { $config['base_url'] = 'http'; + $_SERVER['REQUEST_PROTOCOL'] = 'http'; + } } else if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $config['base_url'] = 'https'; + $_SERVER['REQUEST_PROTOCOL'] = 'https'; } else { $config['base_url'] = 'http'; + $_SERVER['REQUEST_PROTOCOL'] = 'http'; } $config['base_url'] .= "://{$_SERVER['HTTP_HOST']}"; diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index a7be748b..08baf2a2 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -120,7 +120,7 @@ foreach ($urls as $url) $url = trim($url); if ($url == '') continue; print '