Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function middleware($middlewareQueue)
- {
- $securityHeaders = new SecurityHeadersMiddleware();
- $securityHeaders
- ->setCrossDomainPolicy()
- ->setReferrerPolicy()
- ->setXFrameOptions()
- ->setXssProtection()
- ->noOpen()
- ->noSniff();
- $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
- // ]))
- ->add($securityHeaders);
- return $middlewareQueue;
- }
Add Comment
Please, Sign In to add comment