Skip to content

The plugin doesn't seem to honor Etag #23

Closed

Description

@FixedLocally

I have a server which sends back a ETag header of certain assets as follows:

Accept-Ranges: bytes
Content-Length: 166083
Content-Type: image/jpeg
Date: Mon, 02 Jul 2018 13:35:01 GMT
ETag: "99cb5754f1227febf3269ad826d3b5e9"
Last-Modified: Mon, 02 Jul 2018 12:57:31 GMT
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
x-amz-request-id: tx00000000000000056abfb-005b3a2a05-16f571-sgp1a

However, after updating the image, it still displays the old image.

Activity

  1. The-Redhat commented on Oct 11, 2018

    @The-Redhat

    I think that's because how the library works. The cache manger only updates a file when the file is expired (validTill is before the actuall date). When it updates a file it then uses the Etag to determine if there is a newer file on the server. The cache headers include a tag must-revalidate that manages such stuff but the library doesn't support that.

  2. renefloor commented on Oct 13, 2018

    @renefloor
    Contributor

    Indeed, the library only checks if the file is up to date when the max-age is passed and so the cache is expired. If the etag is still the same it updates the age, otherwise the file is refreshed.

    About the must-revalidate:
    "Because a cache MAY be configured to ignore a server's specified expiration time, and because a client request MAY include a max- stale directive (which has a similar effect), the protocol also includes a mechanism for the origin server to require revalidation of a cache entry on any subsequent use. When the must-revalidate directive is present in a response received by a cache, that cache MUST NOT use the entry after it becomes stale to respond to asubsequent request without first revalidating it with the origin server. (I.e., the cache MUST do an end-to-end revalidation every time, if, based solely on the origin server's Expires or max-age value, the cached response is stale.)"
    So must-revalidate only says that a cache has to revalidate when a cache is expired, this is normally optional.

    As far as I know this library follows the defined http logic. If you want to get the update faster set the max-age lower.

  3. shabanov-krl commented on Aug 24, 2023

    @shabanov-krl

    @renefloor

    Web browsers check the etag every time a file is requested and update the cache if the etag does not correspond to what is in the cache.

    Why can't this package do the same?

    I need the cache to be updated if the image has changed on the server.

  4. added a commit that references this issue on Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions