mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 12:18:43 +09:00
Fix Installer when behind a reverse proxy (#1977)
Make sure set: proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto https; When creating then nginx config
This commit is contained in:
1 parent
ec45d3ac06
commit
7e8ff7700a
2 files changed
+10
-2
No files matched your search
@@ -59,7 +59,15 @@ include PATH_LIBRARY . DIRECTORY_SEPARATOR . 'FOSSBilling' . DIRECTORY_SEPARATOR
|
||||
$loader = new FOSSBilling\AutoLoader();
|
||||
$loader->register();
|
||||
$protocol = FOSSBilling\Tools::isHTTPS() ? 'https' : 'http';
|
||||
$url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
|
||||
// Detect if FOSSBilling is behind a proxy server
|
||||
if(!empty($_SERVER['HTTP_X_FORWARDED_HOST'])){
|
||||
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
}else{
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
|
||||
$url = $protocol . '://' . $host . $_SERVER['REQUEST_URI'];
|
||||
$current_url = pathinfo($url, PATHINFO_DIRNAME);
|
||||
$root_url = str_replace('/install', '', $current_url) . '/';
|
||||
define('SYSTEM_URL', $root_url);
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ function checkConfig()
|
||||
if (!$filesystem->exists(PATH_CONFIG)) {
|
||||
if ($filesystem->exists('install/index.php')) {
|
||||
// Build the base URL for the installation, including the protocol and hostname.
|
||||
$base_url = 'http' . ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ? 's' : '') . '://' . ($_SERVER['HTTP_HOST'] ?? '');
|
||||
$base_url = 'http' . ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ? 's' : '') . '://' . (!empty($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']);
|
||||
|
||||
// Append the directory name to the base URL.
|
||||
$base_url .= rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
|
||||
|
||||
Reference in new issue
Block a user