Ad

TYPO3 Remove Cache Comment For Json View

- 1 answer

I want to have a json output of my page, so I have a typoscript setup with diableAllHeaderCode and additionalHeaders Content-Type: application/json Everything is good for the first call after clearing caches, but after that the json format is invalid because typo3 adds a comment to the bottom of the page like <!-- Cached page generated _-_-_ _:_. Expires _-_-_ _:_ --> Can I somehow remove that tag or prevent it from being rendered without blocking the whole caching mechanism ? And I would like to not change the TypoScriptFrontendController.php directly but rather find a solution to manage this from my extension

Ad

Answer

That information is displayed only for development/debug environment.

Dependend on your TYPO3 version you could try to disable this kind of debugging with some typoscript:

either global with config.debug = 0
or specific for your pagetype you use to generate JSON: json.config.debug = 0 (assumed this page object is named json)

Otherwise you test your JSON on the production system.
or you save your output, remove the comment and feed the file to your further process.

Ad
source: stackoverflow.com
Ad