Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Static Asset Cache Buster

Security covered Under active development 265 sites

This module automatically adds a unique cache-busting query parameter to the URLs of static assets like images and files. This ensures that when assets are updated, external caches will fetch the new version instead of serving outdated content. It supports common image and file field formatters.

When static assets, such as images and PDFs, are served by the web server, they are cached by external caches (e.g. Varnish, CDN, browsers). This becomes problematic when a given asset is replaced on the web server.

For example, if https://example.com/sites/default/files/2022-annual-report.pdf is updated with a newer file with the same file name, the external caches will continue to serve the old version. This issue exists when using modules like Media Entity File Replace and Media: Acquia DAM.

This module seeks to address the issue by appending a query string to asset URLs, which acts as a cache buster. The value of the 'cb' query parameter is a hashed/truncated value from the file entity's 'changed' timestamp.

For example, 2022-annual-report.pdf becomes 2022-annual-report.pdf?cb=64227fd1. When the file is updated, the value of the 'cb' query string parameter will change.

This module doesn't provide any configuration.

Supported Uses

This module supports the following use cases:

  • The 'image' and 'responsive_image' theme hooks
    • This includes the 'Image' (image), 'Responsive Image' (responsive_image), and 'URL to image' (image_url) field formatters.
    • Image derivative URLs also also also included.
  • The 'file_link' them hook
    • This includes the the 'Generic file' (file_default), 'Table of Files' (file_table), and 'URL to file' (file_url_plain) field formatters.
Drupal 10–11

Ask your assistant about Static Asset Cache Buster

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Jan 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
1.1.0 Stable 10–11 Aug 28, 2024
1.0.0 Stable 9–10 Mar 31, 2023
1.0.0-beta1 Pre-release 9–10 Jan 17, 2023
1.x-dev Dev 10–11 Jan 17, 2023