fix(runtime): force app_url/force_https per-request via middlewar

This commit is contained in:
xboard
2026-03-19 04:19:29 +08:00
parent 139b34ca19
commit 47983dec40
6 changed files with 34 additions and 11 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
class ApplyRuntimeSettings
{
public function handle(Request $request, Closure $next)
{
$appUrl = admin_setting('app_url');
if (is_string($appUrl) && $appUrl !== '') {
URL::forceRootUrl($appUrl);
}
if ((bool) admin_setting('force_https', false)) {
URL::forceScheme('https');
}
return $next($request);
}
}