Forces HTTPS if possible

This commit is contained in:
marvin23 2024-05-09 13:03:59 +02:00 committed by GitHub
parent 9f3c280684
commit b997a81ef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,7 @@ namespace App\Providers;
use App\Search\Ingredient; use App\Search\Ingredient;
use CloudCreativity\LaravelJsonApi\LaravelJsonApi; use CloudCreativity\LaravelJsonApi\LaravelJsonApi;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -25,6 +26,9 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
if (strpos(env('APP_URL', ''), 'https') !== false) {
URL::forceScheme('https');
}
LaravelJsonApi::defaultApi('v1'); LaravelJsonApi::defaultApi('v1');
if (config('scout.driver') === 'algolia') { if (config('scout.driver') === 'algolia') {