Event/Signal/Hook into Neos before fusion rendering

Hello everyone,

I’m trying to check an GET-parameter before using the value in fusion. I want to validate if the given node identifier exists and otherwise redirect to the 404 error page.
I guess redirecting to the 404 page in fusion is to late and not possible.

With my PHP background I’m searching for some event/signal or hook. Can somebody point me where to find it?

Edit: Maybe there is a fusion solution for that? I won’t exclude that.

Thanks in advance!

Hi Daniel, welcome to the Neos community :slight_smile:

You can look into the middleware topic HTTP Foundation — Flow Framework 8.3.x documentation

An example would be the redirect handler https://github.com/neos/redirecthandler/blob/master/Classes/RedirectMiddleware.php

Hope that helps.

1 Like

Thank you for answering, @sebobo! :slight_smile:

I wrote a Middleware Class but it seems like verifying if a node (provided as a GET param) exist is a little bit to early. I’m facing The security Context cannot be initialized yet. after creating the context with the contextFactory, get the current site node and ask for the given node identifier with the FlowQuery.

So I though of writing my own FlowQueryOperator to use it in fusion but I guess it is not designed to redirect to a 404 page if the element is not given, too.

So I checked the documentation about Routing and Rendering but haven’t found the right place yet.

I think you need to put the middleware at the right position (before routing) for more info just use flow configuration:show on the config path :wink:

And btw you dont need Flowquery context->getNodeByIdentifier is your friend :wink:

Thanks @Marc! flow configuration:show really helped to find the correct spot in the chain.

1 Like