addPlugin('Bake'); } catch (MissingPluginException $e) { // Do not halt if the plugin is missing } $this->addPlugin('Migrations'); } /* * Only try to load DebugKit in development mode * Debug Kit should not be installed on a production system */ if (Configure::read('debug')) { $this->addPlugin(\DebugKit\Plugin::class); } } /** * Setup the middleware queue your application will use. * * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup. * @return \Cake\Http\MiddlewareQueue The updated middleware queue. */ public function middleware($middlewareQueue) { $middlewareQueue // Catch any exceptions in the lower layers, // and make an error page/response ->add(ErrorHandlerMiddleware::class) // Handle plugin/theme assets like CakePHP normally does. ->add(AssetMiddleware::class) // Add routing middleware. // Routes collection cache enabled by default, to disable route caching // pass null as cacheConfig, example: `new RoutingMiddleware($this)` // you might want to disable this cache in case your routing is extremely simple ->add(new RoutingMiddleware($this, '_cake_routes_')) // Add csrf middleware. ->add(new CsrfProtectionMiddleware([ 'httpOnly' => true ])); return $middlewareQueue; } }