Add back force https (#726)

This commit is contained in:
Boy132 2024-11-26 23:27:58 +01:00 committed by GitHub
parent d2d960ecf3
commit ad9447e974
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,9 @@ use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Laravel\Sanctum\Sanctum; use Laravel\Sanctum\Sanctum;
use SocialiteProviders\Discord\Provider; use SocialiteProviders\Discord\Provider;
use SocialiteProviders\Manager\SocialiteWasCalled; use SocialiteProviders\Manager\SocialiteWasCalled;
@ -28,6 +30,11 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(Application $app): void public function boot(Application $app): void
{ {
// If the APP_URL value is set with https:// make sure we force it here. Theoretically
// this should just work with the proxy logic, but there are a lot of cases where it
// doesn't, and it triggers a lot of support requests, so lets just head it off here.
URL::forceHttps(Str::startsWith(config('app.url') ?? '', 'https://'));
Relation::enforceMorphMap([ Relation::enforceMorphMap([
'allocation' => Models\Allocation::class, 'allocation' => Models\Allocation::class,
'api_key' => Models\ApiKey::class, 'api_key' => Models\ApiKey::class,