public function boot()
{
// Set root URL
- URL::forceRootUrl(config('app.url'));
+ $appUrl = config('app.url');
+ if ($appUrl) {
+ $isHttps = (strpos($appUrl, 'https://') === 0);
+ URL::forceRootUrl($appUrl);
+ URL::forceScheme($isHttps ? 'https' : 'http');
+ }
// Custom validation methods
Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) {
putenv('APP_URL=');
}
+ public function test_url_helper_sets_correct_scheme_even_when_request_scheme_is_different()
+ {
+ putenv('APP_URL=https://example.com/');
+ $this->refreshApplication();
+ $this->get('http://example.com/login')->assertSee('https://example.com/dist/styles.css');
+ putenv('APP_URL=');
+ }
+
}
\ No newline at end of file