Laminas Diactoros v1.8.4 Release Notes

Release Date: 2018-08-01 // over 5 years ago
  • โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • ๐Ÿš€ This release modifies how ServerRequestFactory marshals the request URI. In prior releases, we would attempt to inspect the X-Rewrite-Url and X-Original-Url headers, using their values, if present. These headers are issued by the ISAPI_Rewrite module for IIS (developed by HeliconTech). However, we have no way of guaranteeing that the module is what issued the headers, making it an unreliable source for discovering the URI. As such, we have removed this feature in this release of Diactoros.

    If you are developing a middleware application, you can mimic the functionality via middleware as follows:

      use Psr\Http\Message\ResponseInterface;
      use Psr\Http\Message\ServerRequestInterface;
      use Psr\Http\Server\RequestHandlerInterface;
      use Laminas\Diactoros\Uri;
    
      public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
      {
          $requestUri = null;
    
          $httpXRewriteUrl = $request->getHeaderLine('X-Rewrite-Url');
          if ($httpXRewriteUrl !== null) {
              $requestUri = $httpXRewriteUrl;
          }
    
          $httpXOriginalUrl = $request->getHeaderLine('X-Original-Url');
          if ($httpXOriginalUrl !== null) {
              $requestUri = $httpXOriginalUrl;
          }
    
          if ($requestUri !== null) {
              $request = $request->withUri(new Uri($requestUri));
          }
    
          return $handler->handle($request);
      }
    

    If you use middleware such as the above, make sure you also instruct your web server to strip any incoming headers of the same name so that you can guarantee they are issued by the ISAPI_Rewrite module.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • Nothing.