Skip to content

Commit 0a4ba6a

Browse files
committed
Force https on URLs when behind proxy; closes pterodactyl#3623
1 parent 60b8234 commit 0a4ba6a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/Providers/AppServiceProvider.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
use View;
66
use Cache;
7+
use Illuminate\Support\Str;
78
use Pterodactyl\Models\User;
89
use Pterodactyl\Models\Server;
910
use Pterodactyl\Models\Subuser;
11+
use Illuminate\Support\Facades\URL;
1012
use Illuminate\Pagination\Paginator;
1113
use Illuminate\Support\Facades\Schema;
1214
use Illuminate\Support\ServiceProvider;
@@ -32,6 +34,15 @@ public function boot()
3234
View::share('appIsGit', $this->versionData()['is_git'] ?? false);
3335

3436
Paginator::useBootstrap();
37+
38+
// If the APP_URL value is set with https:// make sure we force it here. Theoretically
39+
// this should just work with the proxy logic, but there are a lot of cases where it
40+
// doesn't, and it triggers a lot of support requests, so lets just head it off here.
41+
//
42+
// @see https://github.com/pterodactyl/panel/issues/3623
43+
if (Str::startsWith(config('app.url') ?? '', 'https://')) {
44+
URL::forceScheme('https');
45+
}
3546
}
3647

3748
/**

0 commit comments

Comments
 (0)