A free open source IT asset/license management system
Force UrlGenerator's Root URL to be the base of APP_URL unless overriden
Brady Wetherington455bc736be6f
diff --git a/.env.example b/.env.exampleindex d61960b959..be2d126777 100644--- a/.env.example+++ b/.env.example@@ -149,6 +149,7 @@ APP_LOG_MAX_FILES=10APP_LOCKED=falseAPP_CIPHER=AES-256-CBCAPP_FORCE_TLS=false+APP_ALLOW_INSECURE_HOSTS=falseGOOGLE_MAPS_API=LDAP_MEM_LIM=500MLDAP_TIME_LIM=600diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.phpindex 86903e6dda..1069af4a06 100644--- a/app/Providers/AppServiceProvider.php+++ b/app/Providers/AppServiceProvider.php@@ -43,6 +43,13 @@ class AppServiceProvider extends ServiceProvider}}+ // TODO - isn't it somehow 'gauche' to check the environment directly; shouldn't we be using config() somehow?+ if ( ! env('APP_ALLOW_INSECURE_HOSTS')) { // unless you set APP_ALLOW_INSECURE_HOSTS, you should PROHIBIT forging domain parts of URL via Host: headers+ $url_parts = parse_url(config('app.url'));+ $root_url = $url_parts['scheme'].'://'.$url_parts['host'].( isset($url_parts['port']) ? ':'.$url_parts['port'] : '');+ \URL::forceRootUrl($root_url);+ }+\Illuminate\Pagination\Paginator::useBootstrap();Schema::defaultStringLength(191);