diff --git a/src/CeesVanEgmond/Minify/Minify.php b/src/CeesVanEgmond/Minify/Minify.php index ee727ed..96209b1 100644 --- a/src/CeesVanEgmond/Minify/Minify.php +++ b/src/CeesVanEgmond/Minify/Minify.php @@ -216,10 +216,17 @@ private function checkConfiguration(array $config) * @return string */ private function getBaseUrl() - { - return sprintf("%s://%s", - isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', - $_SERVER['HTTP_HOST'] - ); + { + if (is_null($this->config['base_url']) || (trim($this->config['base_url']) == '')) + { + return sprintf("%s://%s", + isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', + $_SERVER['HTTP_HOST'] + ); + } + else + { + return $this->config['base_url']; + } } -} +} \ No newline at end of file diff --git a/src/CeesVanEgmond/Minify/MinifyServiceProvider.php b/src/CeesVanEgmond/Minify/MinifyServiceProvider.php index 5aeff84..28259d9 100644 --- a/src/CeesVanEgmond/Minify/MinifyServiceProvider.php +++ b/src/CeesVanEgmond/Minify/MinifyServiceProvider.php @@ -42,6 +42,7 @@ public function register() 'css_build_path' => Config::get('minify::css_build_path'), 'js_build_path' => Config::get('minify::js_build_path'), 'ignore_environments' => Config::get('minify::ignore_environments'), + 'base_url' => Config::get('minify::base_url'), ), $app->environment() ); diff --git a/src/config/config.php b/src/config/config.php index 03231ef..1c685e5 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -44,4 +44,14 @@ 'js_build_path' => '/js/builds/', -); + /* + |-------------------------------------------------------------------------- + | Base URL + |-------------------------------------------------------------------------- + | + | You can set the base URL for the links generated with the configuration + | value. By default if empty HTTP_HOST would be used. + | + */ + 'base_url' => '' +); \ No newline at end of file