Files
merchbay_admin/app/Providers/AppServiceProvider.php
Frank John Begornia 58e1bad1cf
Some checks failed
Deploy Development / deploy (push) Failing after 2m14s
Enhance AppServiceProvider to force HTTPS when behind a proxy
2025-12-18 12:24:02 +08:00

39 lines
847 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\Filesystem;
use League\Flysystem\Sftp\SftpAdapter;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// Force HTTPS when behind a proxy (Traefik)
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
\URL::forceScheme('https');
}
Storage::extend('sftp', function ($app, $config) {
return new Filesystem(new SftpAdapter($config));
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}