3 namespace BookStack\Http\Middleware;
5 use Illuminate\Http\Request;
6 use Illuminate\Session\Middleware\StartSession as Middleware;
9 * An extended version of the default Laravel "StartSession" middleware
10 * with customizations applied as required:
12 * - Adds filtering for the request URLs stored in session history.
14 class StartSessionExtended extends Middleware
16 protected static array $pathPrefixesExcludedFromHistory = [
23 protected function storeCurrentUrl(Request $request, $session): void
25 $requestPath = strtolower($request->path());
26 foreach (static::$pathPrefixesExcludedFromHistory as $excludedPath) {
27 if (str_starts_with($requestPath, $excludedPath)) {
32 parent::storeCurrentUrl($request, $session);