| namespace App\Providers; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Support\ServiceProvider; | |
| use Illuminate\Support\Facades\URL; | |
| class AppServiceProvider extends ServiceProvider | |
| { | |
| /** | |
| * Register any application services. | |
| */ | |
| public function register(): void | |
| { | |
| // | |
| } | |
| /** | |
| * Bootstrap any application services. | |
| */ | |
| public function boot(): void | |
| { | |
| if (! app()->environment('production')) { | |
| return; | |
| } | |
| $request = request(); | |
| if (! $request instanceof Request) { | |
| return; | |
| } | |
| $host = (string) $request->getHost(); | |
| if ($host !== '' && str_ends_with($host, '.hf.space')) { | |
| URL::forceScheme('https'); | |
| } | |
| } | |
| } | |