Removing Middleware from the Application


You want to remove a piece of middleware from the your application.


Use the App::removeMiddleware() method.

// Remove a class you've already registered

// Remove the FrameGuard middleware


This low level method must be called early in the lifecycle.

Specifically, it must be called within the register() method of a service provider. If you call it any later it will have no effect.

The point you must call this method is before the block labeled "Build stacked HTTP Kernel" in the booting steps displayed in the Understanding the Request Lifecycle recipe.

You cannot remove the following middleware from your application:

  • Illuminate\Cookie\Guard
  • Illumiante\Cookie\Queue
  • Illuminate\Session\Middleware

These items are provided by Laravel's core.

comments powered by Disqus