oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose Middleware

undercloud opened this issue · comments

Feature

<?php
namespace Psr7Middlewares\Middleware;

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
 * Middleware to remove php information
 */
class Expose
{
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
    {
        $response = $response->withoutHeader('X-Powered-By');

        return $next($request, $response);
    }
}

That's good idea but this header is send automatically by php and the only way to disable it is editing the config variable in php.ini or using:

ini_set('expose_php', 0);