Enhance AppServiceProvider to force HTTPS when behind a proxy
Some checks failed
Deploy Development / deploy (push) Failing after 2m14s

This commit is contained in:
Frank John Begornia
2025-12-18 12:24:02 +08:00
parent 110c0f7291
commit 58e1bad1cf

View File

@@ -16,7 +16,10 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot() 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) { Storage::extend('sftp', function ($app, $config) {
return new Filesystem(new SftpAdapter($config)); return new Filesystem(new SftpAdapter($config));