Skip to content

Commit

Permalink
[4.x] Fix statamic.web middleware not being merged (#8935)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
duncanmcclean and jasonvarga authored Nov 6, 2023
1 parent f7c2521 commit 259f7ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public function boot()
$this->app->booted(function () {
Statamic::runBootedCallbacks();
$this->loadRoutesFrom("{$this->root}/routes/routes.php");
$this->registerMiddlewareGroup();
});

$this->registerMiddlewareGroup();

$this->app[\Illuminate\Contracts\Http\Kernel::class]
->pushMiddleware(\Statamic\Http\Middleware\PoweredByHeader::class)
->pushMiddleware(\Statamic\Http\Middleware\CheckComposerJsonScripts::class)
Expand Down Expand Up @@ -166,14 +165,16 @@ public function register()

protected function registerMiddlewareGroup()
{
$this->app->make(Router::class)->middlewareGroup('statamic.web', [
$router = $this->app->make(Router::class);

collect([
\Statamic\Http\Middleware\StacheLock::class,
\Statamic\Http\Middleware\HandleToken::class,
\Statamic\Http\Middleware\Localize::class,
\Statamic\Http\Middleware\AddViewPaths::class,
\Statamic\Http\Middleware\AuthGuard::class,
\Statamic\StaticCaching\Middleware\Cache::class,
]);
])->each(fn ($middleware) => $router->pushMiddlewareToGroup('statamic.web', $middleware));
}

protected function addAboutCommandInfo()
Expand Down

0 comments on commit 259f7ae

Please sign in to comment.