Deploy Ladill Events / deploy (push) Successful in 27s
External /q requests 301/307 to ladl.link; internal X-Ladill-Internal requests still serve content for platform proxying. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
556 B
PHP
25 lines
556 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Support\LadillLink;
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class RedirectLegacyQrToLadillLink
|
|
{
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
if (! preg_match('#^q/[a-z0-9]#i', ltrim($request->path(), '/'))) {
|
|
return $next($request);
|
|
}
|
|
|
|
if (LadillLink::isInternalRequest($request)) {
|
|
return $next($request);
|
|
}
|
|
|
|
return LadillLink::legacyRedirect($request);
|
|
}
|
|
}
|