Cache expiring too quickly

Comments

3 comments

  • Austin Spires

    Hey @tommy, it looks like there's a Set-Cookie header in the first response, but not the second. Is that typical behavior?

    On a side note, Fastly will never cache a response with a Set-Cookie header, as we don't want to cache sessions or other user-specific content.

  • tommy

    @aspires thanks! I tracked down some cookies that were escaping, that I didn't expect to be. I'll make the necessary corrections and hopefully that fixes the problem!

  • tommy

    @aspires, I'm seeing the same behavior, with the issue with Set-Cookie fixed:

    Here are response headers from requests to https://nuu-acceptance-herokuapp-com.global.ssl.fastly.net/attachments/efccc35acccbbce0d5ac3635226acdef62a4305f/store/fit/240/160/62a3a81436c6f407769d1364620ade57f47a4bac73aa5e5b0b122ba7ca1d/file.jpg, separated by only a few minutes:

    RESPONSE 1:
    ----------
    Strict-Transport-Security: max-age=31536000
    Content-Encoding: gzip
    X-Content-Type-Options: nosniff
    Age: 0
    Transfer-Encoding: chunked
    X-Cache: MISS
    X-Cache-Hits: 0
    Content-Disposition: inline; filename="file.jpg"
    Connection: keep-alive
    Via: 1.1 vegur
    Via: 1.1 varnish
    X-Request-Id: 069c3e20-77e0-45de-b02c-5f0ad14a05c6
    X-Served-By: cache-lax1431-LAX
    X-Runtime: 0.284616
    Last-Modified: Tue, 23 Jun 2015 22:28:30 GMT
    Server: Cowboy
    X-Timer: S1435098509.559662,VS0,VE583
    Date: Tue, 23 Jun 2015 22:28:30 GMT
    Vary: Accept-Encoding
    Content-Type: image/jpeg
    Access-Control-Allow-Origin: *
    Cache-Control: public, must-revalidate, max-age=31536000
    Accept-Ranges: bytes
    Expires: Wed, 22 Jun 2016 22:28:30 GMT
    ----------
    RESPONSE 2:
    ----------
    Strict-Transport-Security: max-age=31536000
    Content-Encoding: gzip
    X-Content-Type-Options: nosniff
    Age: 0
    Transfer-Encoding: chunked
    X-Cache: MISS
    X-Cache-Hits: 0
    Content-Disposition: inline; filename="file.jpg"
    Connection: keep-alive
    Via: 1.1 vegur
    Via: 1.1 varnish
    X-Request-Id: c1c2e0a3-7eeb-4b79-8278-c0f7de278064
    X-Served-By: cache-lax1432-LAX
    X-Runtime: 0.279486
    Last-Modified: Tue, 23 Jun 2015 22:33:46 GMT
    Server: Cowboy
    X-Timer: S1435098825.623076,VS0,VE576
    Date: Tue, 23 Jun 2015 22:33:46 GMT
    Vary: Accept-Encoding
    Content-Type: image/jpeg
    Access-Control-Allow-Origin: *
    Cache-Control: public, must-revalidate, max-age=31536000
    Accept-Ranges: bytes
    Expires: Wed, 22 Jun 2016 22:33:46 GMT
    

    For what it's worth, the misses all seem to happen on lax machines. Is there anything else I should check?

    EDIT

    The following morning, with cookies completely removed, I am seeing close to a 30% miss rate on requests going through Fastly. I'm beginning to think that Fastly is just evicting some of my files from its cache. Is there any other explanation for what might be going on?

Please sign in to leave a comment.