Front controller: remove the internal release prefix Strato puts into REQUEST_URI (signed links)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 22:28:43 +02:00
1 parent 565eee4325
commit 20235b9139
1 file changed
+7 -4
+7 -4
View File
@@ -13,10 +13,13 @@
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Strato: the domain points at the deployment folder and .htaccess forwards to releases/<version>/public.
// The script then lives below that path, so the base URL would contain it and signed links would not
// match. The site is always served from the domain root, therefore the script is reported as /index.php.
if (preg_match('~/(releases/[^/]+|current)/public/index\.php$~', $_SERVER['SCRIPT_NAME'] ?? '')) {
// Strato: the domain points at the deployment folder and .htaccess forwards to releases/<version>/public,
// and the web server then reports the rewritten path in REQUEST_URI/SCRIPT_NAME. Laravel would see
// "/releases/…/public/angebot/2" instead of "/angebot/2" (signed links would fail). The site is always
// served from the domain root, so the internal prefix is removed here.
if (preg_match('~^/(?:releases/[^/?]+|current)/public(?=[/?]|$)~', $_SERVER['REQUEST_URI'] ?? '', $internalPrefix)) {
$path = substr($_SERVER['REQUEST_URI'], strlen($internalPrefix[0]));
$_SERVER['REQUEST_URI'] = str_starts_with($path, '/') ? $path : '/'.$path;
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = '/index.php';
}