HTTP middlewares are configured in concrete/config/app.php

    'middleware' => [
        [
            'priority' => 1,
            'class' => \Concrete\Core\Http\Middleware\ApplicationMiddleware::class,
        ],
        'core_cookie' => \Concrete\Core\Http\Middleware\CookieMiddleware::class,
        'core_xframeoptions' => \Concrete\Core\Http\Middleware\FrameOptionsMiddleware::class,
        'core_thumbnails' => '\Concrete\Core\Http\Middleware\ThumbnailMiddleware',
    ],

You can add your own middleware by overriding config value from application/config/app.php. Of course, you can change the class too.

return [
    'middleware' => [
        'core_cookie' => \Application\Concrete\Http\Middleware\MyCustomizedCookieMiddleware::class,
        'my_great_middleware' => \Application\Concrete\Http\Middleware\MyGreatMiddleware::class,
    ],
];

If you want to remove a core middleware, you need to create a passthru middleware.

return [
    'middleware' => [
        'core_xframeoptions' => \Application\Concrete\Http\Middleware\PassThruMiddleware::class,
    ],
];
<?php
namespace Application\Concrete\Http\Middleware;

use Concrete\Core\Http\Middleware\DelegateInterface;
use Concrete\Core\Http\Middleware\MiddlewareInterface;
use Symfony\Component\HttpFoundation\Request;

class PassThruMiddleware implements MiddlewareInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(Request $request, DelegateInterface $frame)
    {
        // PassThru
        return $frame->next($request);
    }
}
Loading Conversation