Title: Cloudfront expiration issues
Last modified: September 18, 2019

---

# Cloudfront expiration issues

 *  [pkostadinov](https://wordpress.org/support/users/pkostadinov/)
 * (@pkostadinov)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/cloudfront-expiration-issues/)
 * I had the issue when after Autoptimize cache flush, Cloudfront served page without
   CSS. This happened when the expiration of the autoptimize_md5.css was expired,
   however some pages were still not expired, so cloudfront served the cached page,
   pointing to the old autoptimize_md5.css, and when the old one wasn’t found, the
   page loaded without css and js.
 * I approached the problem from 2 perspectives:
    – I have written a cloudfront 
   invalidation on Autoptimize cache flush action, with the important caveat that
   it won’t send request to cloudfront more than once in every 5 minutes, because
   they charge for this (after the 1000th invalidation each month). – I have played
   with expiration times, and specifically set Autoptimize assets in wp-content/
   cache/autoptimize to expire after 1 month (should be at least 4 times more than
   the pages themselves).
 * I am both sharing the experience, and asking if anyone had the same issue, and
   had a better solution.

The topic ‘Cloudfront expiration issues’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [CloudFront](https://wordpress.org/support/topic-tag/cloudfront/)
 * [expiration](https://wordpress.org/support/topic-tag/expiration/)
 * [invalidation](https://wordpress.org/support/topic-tag/invalidation/)

 * 0 replies
 * 1 participant
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/cloudfront-expiration-issues/)
 * Status: not a support question