Add config parameter to define base URL (#625)
This commit is contained in:
parent
86d981fa90
commit
9b670a9909
@ -24,6 +24,7 @@ defined('DB_PASSWORD') or define('DB_PASSWORD', '');
|
|||||||
defined('DEBUG_MODE') or define('DEBUG_MODE', false);
|
defined('DEBUG_MODE') or define('DEBUG_MODE', false);
|
||||||
defined('DEBUG_FILENAME') or define('DEBUG_FILENAME', DATA_DIRECTORY.DIRECTORY_SEPARATOR.'debug.log');
|
defined('DEBUG_FILENAME') or define('DEBUG_FILENAME', DATA_DIRECTORY.DIRECTORY_SEPARATOR.'debug.log');
|
||||||
|
|
||||||
|
defined('BASE_URL') or define('BASE_URL', '');
|
||||||
defined('THEME_DIRECTORY') or define('THEME_DIRECTORY', 'themes');
|
defined('THEME_DIRECTORY') or define('THEME_DIRECTORY', 'themes');
|
||||||
defined('THEME_URL_PATH') or define('THEME_URL_PATH', 'themes');
|
defined('THEME_URL_PATH') or define('THEME_URL_PATH', 'themes');
|
||||||
defined('SESSION_SAVE_PATH') or define('SESSION_SAVE_PATH', '');
|
defined('SESSION_SAVE_PATH') or define('SESSION_SAVE_PATH', '');
|
||||||
|
@ -44,16 +44,20 @@ function parse_app_version($refnames, $commithash)
|
|||||||
|
|
||||||
function get_current_base_url()
|
function get_current_base_url()
|
||||||
{
|
{
|
||||||
|
if(BASE_URL) {
|
||||||
|
$url = BASE_URL;
|
||||||
|
return rtrim($url, '/') . '/';
|
||||||
|
} else {
|
||||||
$url = is_secure_connection() ? 'https://' : 'http://';
|
$url = is_secure_connection() ? 'https://' : 'http://';
|
||||||
$url .= $_SERVER['HTTP_HOST'];
|
$url .= $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
if (strpos($_SERVER['HTTP_HOST'], ':') === false) {
|
if (strpos($_SERVER['HTTP_HOST'], ':') === false) {
|
||||||
$url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT'];
|
$url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$url .= str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])) !== '/' ? str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])).'/' : '/';
|
$url .= str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])) !== '/' ? str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])).'/' : '/';
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_secure_connection()
|
function is_secure_connection()
|
||||||
|
@ -6,6 +6,9 @@ define('HTTP_TIMEOUT', '20');
|
|||||||
// HTTP_MAX_RESPONSE_SIZE => Maximum accepted size of the response body in MB (default 2MB)
|
// HTTP_MAX_RESPONSE_SIZE => Maximum accepted size of the response body in MB (default 2MB)
|
||||||
define('HTTP_MAX_RESPONSE_SIZE', 2097152);
|
define('HTTP_MAX_RESPONSE_SIZE', 2097152);
|
||||||
|
|
||||||
|
// BASE_URL => URL that clients should access this instance of miniflux from
|
||||||
|
define('BASE_URL', '');
|
||||||
|
|
||||||
// DATA_DIRECTORY => default is data (writable directory)
|
// DATA_DIRECTORY => default is data (writable directory)
|
||||||
define('DATA_DIRECTORY', 'data');
|
define('DATA_DIRECTORY', 'data');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user