diff --git a/Classes/Middleware/SolrRoutingMiddleware.php b/Classes/Middleware/SolrRoutingMiddleware.php index 42a5a38e71..c1fd8a603b 100644 --- a/Classes/Middleware/SolrRoutingMiddleware.php +++ b/Classes/Middleware/SolrRoutingMiddleware.php @@ -17,6 +17,7 @@ namespace ApacheSolrForTypo3\Solr\Middleware; +use ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerRequest; use ApacheSolrForTypo3\Solr\Routing\RoutingService; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -100,6 +101,10 @@ public function injectRoutingService(RoutingService $routingService) */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { + if (!$request->hasHeader(PageIndexerRequest::SOLR_INDEX_HEADER)) { + return $handler->handle($request); + } + /* @var SiteRouteResult $routeResult */ $routeResult = $this->getRoutingService() ->getSiteMatcher() diff --git a/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php b/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php index a2d08d36f5..13d28f0ccf 100644 --- a/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php +++ b/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php @@ -16,6 +16,7 @@ namespace ApacheSolrForTypo3\Solr\Tests\Unit\Middleware; +use ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerRequest; use ApacheSolrForTypo3\Solr\Middleware\SolrRoutingMiddleware; use ApacheSolrForTypo3\Solr\Routing\RoutingService; use ApacheSolrForTypo3\Solr\Tests\Unit\UnitTest; @@ -90,7 +91,10 @@ public function missingEnhancerHasNoEffectTest() { $serverRequest = new ServerRequest( 'GET', - 'https://domain.example/facet/bar,buz,foo' + 'https://domain.example/facet/bar,buz,foo', + [ + PageIndexerRequest::SOLR_INDEX_HEADER => '1', + ] ); $siteMatcherMock = $this->getMockBuilder(SiteMatcher::class) ->disableOriginalConstructor()