Logo Knowledge
  • Product Documentation
  • Insight
  • Developer Center
  • Training
  • Submit a Request
  • Product Documentation
  • Insight
  • Developer Center
  • Training
  • Submit a Request
  1. Acquia Support Knowledge Base
  2. Troubleshooting
  3. Common Problem

Cache time on updated files

    See more
    • Updated
    • December 22, 2020 01:14

    Issue

    Files are not being updated when a new file is uploaded.

    Cause

    File cache time is set independently of your website's cache duration. The cache time on files is set in the .htaccess file, and the default is two weeks:

    # Cache all files for 2 weeks after access (A).
    ExpiresDefault A1209600

    This means you could have to wait up to two weeks to see your new file in a browser, as the file will be cached in the users' local browser caches and Varnish cache for up to two weeks. Note: these files can still be stored in local browser caches despite clearing Drupal and/or Varnish cache. 

    You can see the cache time on the file by requesting it using curl from the command line, the max-age=1209600 value (which is in seconds, and equals two weeks) in the output:

    $ curl -sLIXGET www.websiteurl.com/link/to/file.pdf
    {..SNIP..}
    Cache-Control: max-age=1209600

    Resolution

    The easiest way to resolve this issue is to upload the file with a new file name to differentiate it (for example append a number to the end of the file name), and then update the corresponding locations where it is being used. We recommend that after uploading the new file, delete the old file (from the server) to keep the file storage under control.

    Alternatively, you could implement a reduced cache duration for specific files, however any local browser cached copies of the file will remain there for up to two weeks and it will only be new requests to the specific files that will respect this change (once implemented). We advise against turning the caching off or setting the max-age to 0 as this may open your site up to a potential DDoS vector.

    Acquia recommends that you thoroughly test any changes to reducing cache as this could increase the load on your servers and impact site performance.

    Creating a custom caching policy:

    • Creating custom caching policy per file type
    • Set max-age headers for specific pages, files, or paths

    Acquia Products

    • Not Applicable

    Topics

    • cache

    In this Series

    • Deleted files remaining in cache
    Avatar
    Mikaela McGrath
    • December 22, 2020 01:14
    • Updated
    • Facebook
    • Twitter
    • LinkedIn

    Was this article helpful?
    0 out of 0 found this helpful

    Return to top

    Related articles

    • Set max-age headers for specific pages, files, or paths
    • Deleted files remaining in cache
    • Drush cache clears can cause Cloud Hooks failure
    • How to verify a User Agent block in the webserver logs
    • Introduction to Varnish

    Support

    Acquia Support Knowledge Base
    • Submit a Request
    • Contact Support
    • Acquia Support Guide
    • Product Documentation
    • System Status

    About Acquia

    • About Us
    • Leadership
    • Board of directors
    • Newsroom
    • Careers
    • Customers
    • Contact Us
    53 State Street, 10th Floor
    Boston, MA 02109
    United States
    Phone: 888-922-7842
    Map: Google Maps
    View other locations
    • Feeds
    • Legal
    • Security Issue?

    Copyright © 2018 Acquia Inc. All Rights Reserved. Drupal is a registered trademark of Dries Buytaert.