• Resolved Megunticook

    (@megunticook)


    Recently switched to W3TC using origin push with Amazon S3 and CloudFront CDN.

    GTMetrix reports “expiration not specified” on files served from the CDN, giving me a score of 0 on browser caching.

    But when I inspect the first file on the list in the GTMetrix report, it appears to have expiration specified. What am I missing here? Thanks. Response Header below:

    Request URL: https://cdn.swansislandcompany.com/wp-content/plugins/contact-form-7/includes/css/styles.css.gzip
    Request Method: GET
    Status Code: 304 
    Remote Address: 13.225.224.55:443
    Referrer Policy: no-referrer-when-downgrade
    cache-control: max-age=864000
    date: Mon, 29 Jul 2019 11:23:57 GMT
    etag: "f026e73e8b072cc3ae1491702b9c491a"
    expires: access plus 10 days
    last-modified: Mon, 22 Jul 2019 13:46:53 GMT
    server: AmazonS3
    status: 304
    via: 1.1 fb7a91e6436d6c6ab7f46f75c256840c.cloudfront.net (CloudFront)
    x-amz-cf-id: 82BiYlCx4hd2y7B_zHpEPAAA_Gepd4d3aSpSGDnxw-yVmOhwS-F9Cw==
    x-amz-cf-pop: JFK51-C1
    x-amz-meta-access-control-allow-origin: *
    x-amz-meta-content-encoding: gzip
    x-amz-meta-content-type: text/css
    x-amz-meta-last-modified: Sun, 07 Jul 2019 10:54:44 GMT
    x-amz-meta-link: <https://swansislandcompany.com/var/www/html/wp-content/plugins/contact-form-7/includes/css/styles.css>; rel="canonical"
    x-amz-meta-vary: Accept-Encoding
    x-cache: Miss from cloudfront

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @megunticook,

    I am sorry you are having issues with Browser Cache settings but I am happy to assist you.
    In your GTmetrix report, when you hover over “What’s this mean?” under Leverage browser caching, you’ll see the following:
    “General guidelines for setting expiries:
    Truly static content (global CSS styles, logos, etc.) – access plus 1 year
    Everything else – access plus 1 week”.
    In your case, expiration is set to 10 days, which is not enough, static files like CSS should be 1 year.
    I hope this helps.

    Thread Starter Megunticook

    (@megunticook)

    So in other words GTMetrix doesn’t consider 10 days sufficient? OK, I can make that change easy enough.

    And if I make a CSS change at some point before that year is up, will people with the old stylesheet cached in their browser see the new styles?

    Thanks for your help.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @megunticook,

    In order to make sure that updates CSS is available to the visitors, you should add a random query string to the CSS file you are changing. That way, the browser is going cache the updated stylesheet as a new one. If you make changes to the CSS and don’t change the query string, the browser will not attempt to serve the updated CSS to the users as it thinks that its already doing that. So the users will need to empty their browser cache in this case. You should also set Cache-Control Policy to cache with validation

    So in other words GTMetrix doesn’t consider 10 days sufficient? OK,codenab I can make that change easy enough.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘GTMetrix not seeing cache expires headers?’ is closed to new replies.