Community Budget Report — Future of The StaticFileCache Extension

Categories: Budget idea, Development, Community, TYPO3 CMS Created by Tim Lochmüller
Stacks of various colorful paper files and documents, densely packed and organized on shelves, creating a visually textured pattern with edges visible, and some paper edges showing different colors like yellow, red, and green.
A budget proposal titled Future of StaticFileCache, was submitted and approved for Q4 2024, aiming to advance the development of this popular TYPO3 extension. Over the past few weeks, the planned milestones have been successfully completed and are now part of the newly released version 15.1.1.

Here are some details about the improvements and background of this update.

What is The StaticFileCache Extension?

The StaticFileCache extension (staticfilecache) is a TYPO3 extension that enables caching of pages as static files. This allows fully cacheable pages to be delivered directly by the web server (Apache/nginx), bypassing the PHP interpreter. The result: significantly faster load times and reduced server load.

Since it does not require dynamic TYPO3 processes, the extension is particularly suitable for managed server environments. Introduced on August 30, 2006 (initially named fl_staticfilecache), it has been a favored tool for TYPO3 websites, especially those hosted on smaller servers.

Focus: TYPO3 v12 and v13

One of the primary goals of the update was to provide a stable version compatible with TYPO3 v13. This version is now available in the TYPO3 Extension Repository (TER) and on Packagist, supporting both TYPO3 v12 and v13. This should simplify the TYPO3 upgrade process, making the extension update straightforward.

During development, the new requirements of TYPO3 v13 were addressed, including:

  • Support for the backend module’s dark mode.
  • Review and removal of deprecations.
  • Compatibility testing with PHP 8.3.

This ensures that the extension is not only compatible with the latest TYPO3 versions but also with modern PHP versions.

Transition to PSR-14 Events

Previously, the extension used its own registration stack to manage functions such as caching rules, generating cache files, and HTTP/2 push headers. This proprietary solution has been replaced with standardized PSR-14 events. It is a more generic approach and easier to adapt. Thank you, PSR!

The key events introduced include:

  • CacheRuleEvent
  • GeneratorCreate
  • GeneratorRemove
  • HttpPushHeaderEvent

Additionally, more events have been implemented to make the extension workflow more flexible and customizable. The enhanced documentation provides a description of these events and middleware interaction: Extended chapter of the documentation.

This transition makes the extension more future-proof and adaptable to external changes and evolving caching strategies for websites.

CSP-Handling (Content Security Policy)

Since TYPO3 v12, the TYPO3 Core includes robust Content Security Policy (CSP) integration, enhancing frontend security. However, this introduces a challenge: CSP uses nonce values replaced in TYPO3 via *_INT objects. This prevents full-page caching when CSP is enabled in the frontend, meaning the page cannot be stored in StaticFileCache.

To address this, StaticFileCache now includes its own solution. With the new cspGenerationOverride configuration, nonce replacement can be selectively ignored, enabling static file creation. If there are additional non-cacheable elements, the rules still function correctly and avoid generating static files.

A long-term fix is underway. Support for the Core review process is welcome: TYPO3 Gerrit Review.

Fine Tuning and Additional Improvements

The new version also features:

  • Removal of outdated functions (deprecations).
  • Migration of various code components to dependency injection (DI).
  • Resolution and closure of all open issue tracker tickets.
  • Additional code adjustments and cleanups.

Conclusion: Faster, More Flexible, Future-Proof

Version 15.1.1 of the StaticFileCache extension represents a significant milestone for this budget idea. Thanks to the recent adjustments, the extension is not only more powerful but also better suited to current and future demands. Many thanks to the TYPO3 Association for the fantastic idea of community budgets and the support.

I hope you enjoy the new version and I always welcome feedback to help make the internet a little faster!

Additional contributors for this article
  • Copy Editor : Felicity Brand
  • Content Publisher : Mathias Bolt Lesniak