🚀 Configure HTTP Middleware (PSR-15) in Flow Framework

With the release of Flow 7.0 we have removed our custom implemented HTTP Component concept and replaced it with PSR-15 HTTP Middleware.

This allows you to use already made PSR-15 middlewares simply from configuration 🚀

For example, add a ResponseTime header to your request by reusing this middleware

https://github.com/middlewares/psr15-middlewares

Install it with composer

composer require middlewares/response-time

And add the it to your HTTP middleware chain of Flow Framework, by adding a Settings.yaml file with this content

Neos:
  Flow:
    http:
      middlewares:
        'responseTime':
          position: 'start'
          middleware: 'Middlewares\ResponseTime'

And since it follows the MiddlewareInterface (see code here) and therefore implements the process(...) method we do not need to do more.

I now have a added header in my response, thanks to the ResponseTime middleware

Added X-Response-Time from installed Middleware

Leave a Reply

Your email address will not be published. Required fields are marked *