#99417No way to get frontend.typoscript (TypoScript setup) in Middleware when page was cached
Description
Currently (Version 12.1) there seems to be no possibilty to get the Typoscript Setup in a Middleware, if the page was previously cached.
This problem is probably related to the changes made in
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.1/Feature-98914-TypoScriptAsRequestAttribute.html
How to reproduce:
- write a Middleware that tries to access the TypoScript-Array using `$request->getAttribute(‘frontend.typoscript’)->getSetupArray()` and hook it in at a place, where the Frontend is usually initialized (e.g. after `typo3/cms-frontend/shortcut-and-mountpoint-redirect`)
- Clear the cache in the backend
- First page load works
- Second page load (from cache) will result in the Fatal error “Setup array has not been initialized. This happens in cached Frontend scope where full TypoScript is not needed by the system.”
Many of our extensions rely on getting settings from TypoScript to process the request (e.g. EXT:nnrestapi).
Currently we have no idea how to solve this problem other than caching the complete TypoScript setup ourselves or deactiving the frontend cache completely.