---
title: "RequestMiddlewares.php"
manual: "TYPO3 Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3coreapi:extension-configuration-requestmiddlewares-php@main"
source: "ExtensionArchitecture/FileStructure/Configuration/RequestMiddlewaresPhp.rst"
modified: "2026-09-16T13:05:25+00:00"
---

# `RequestMiddlewares.php`

-   **RequestMiddlewares.php**

    -   *Scope:* extension
    -   *Path (Composer):* packages/my_extension/Configuration/RequestMiddlewares.php
    -   *Path (Classic):* typo3conf/ext/my_extension/Configuration/RequestMiddlewares.php

    Configuration of custom middleware for frontend and backend. Extensions that
    add middleware or disable existing middleware are configured in this file. The
    file must return an array with the configuration.

    See [Configuring middlewares](https://docs.typo3.org/permalink/t3coreapi:request-handling-configuring-middlewares@main)
    for details.

**EXT:some_extension/Configuration/RequestMiddlewares.php**

```php
<?php

return [
  'frontend' => [
    'middleware-identifier' => [
      'target' => \Vendor\SomeExtension\Middleware\ConcreteClass::class,
      'before' => [
        'another-middleware-identifier',
      ],
      'after' => [
        'yet-another-middleware-identifier',
      ],
    ],
  ],
  'backend' => [
    'middleware-identifier' => [
      'target' => \Vendor\SomeExtension\Middleware\AnotherConcreteClass::class,
      'before' => [
        'another-middleware-identifier',
      ],
      'after' => [
        'yet-another-middleware-identifier',
      ],
    ],
  ],
];

```
