Skip to content

Commit 27a895d

Browse files
committed
Force HTTPS for Laravel assets
1 parent c23e791 commit 27a895d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/Providers/AppServiceProvider.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Providers;
44

5+
use Illuminate\Routing\UrlGenerator;
56
use Illuminate\Support\ServiceProvider;
67

78
class AppServiceProvider extends ServiceProvider
@@ -19,10 +20,13 @@ public function register()
1920
/**
2021
* Bootstrap any application services.
2122
*
23+
* @param UrlGenerator $url
2224
* @return void
2325
*/
24-
public function boot()
26+
public function boot(UrlGenerator $url)
2527
{
26-
//
28+
if (env('APP_ENV') == 'production') {
29+
$url->forceScheme('https');
30+
}
2731
}
2832
}

0 commit comments

Comments
 (0)