admin: force https scheme/root URL behind Caddy (fixes mixed-content broken CSS/JS)

This commit is contained in:
2026-08-08 08:39:54 +10:00
parent aa465cae2e
commit 3e571f75bf

View File

@@ -2,23 +2,25 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
/**
* Register any application services.
*/
public function register(): void public function register(): void
{ {
// //
} }
/**
* Bootstrap any application services.
*/
public function boot(): void public function boot(): void
{ {
// // Behind Caddy (TLS terminated upstream, http internally), force
// https:// URLs so assets and forms do not become mixed content.
if (str_starts_with((string) config("app.url"), "https://")) {
URL::forceScheme("https");
URL::forceRootUrl(config("app.url"));
} }
} }
}
'PHPEOF'
php -l app/Providers/AppServiceProvider.php >/dev/null && echo "repo updated" && cat app/Providers/AppServiceProvider.php | head -5