Hello,
I have a very strange problem with the RedirectHandler, which I think has something to do with the default routes from the Neos.Flow package.
I am using Neos 7.2.1 (which has been updated from rather a rather old version, 3.3 I think) and the latest version of the RedirectHandler packages.
On my production server no redirect from the RedirectHandler matches.
On my development server it works correctly (even with FLOW_CONTEXT=Production).
I narrowed down the problem to the RedirectMiddleware class:
$routingMatchResults = $request->getAttribute(ServerRequestAttributes::ROUTING_RESULTS);
if ($routingMatchResults !== null) {
return $next->handle($request);
}
$response = $this->redirectService->buildResponseIfApplicable($request);
return $response ?? $next->handle($request);
If I understand the redirection process correctly, the RedirectService should only check for redirects from the database, if no flow route matches.
On the production server, the middleware will always match a route, which is the Neos.Flow default route.
./flow routing:list
on the production server results in:
... | 86 | {@package}/{@controller}/{@action}(.{@format}) | any | Neos.Flow :: default with action and format | | 87 | {@package}/{@controller}(/{@action}) | any | Neos.Flow :: default | | 88 | {@package} | any | Neos.Flow :: default with package | | 89 | | any | Neos.Flow :: fallback |
./flow routing:list
does not list the last four routes.
So my questions are:
- Should the Neos.Flow default routes match if a Redirect exists?
- Should the Neos.Flow default routes even exist? And if not: How can I disable them?
If it helps:
I also tried to find more differences between the production and development server and found that the generated PackageInformationCache.php is different. It contains the same flow packages, but in different order. In both files however, the neos/flow package is before the neos/redirecthandler package.
I am really confused by this…
Regards
Leif