33 lines
785 B
PHP
33 lines
785 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Always force HTTPS when request comes via HTTPS
|
|
// Important for Livewire signed URLs (file uploads) behind Traefik proxy
|
|
$scheme = request()->header('X-Forwarded-Proto')
|
|
?? request()->server('HTTP_X_FORWARDED_PROTO')
|
|
?? (request()->secure() ? 'https' : 'http');
|
|
|
|
if ($scheme === 'https') {
|
|
URL::forceScheme('https');
|
|
}
|
|
}
|
|
}
|