The rack_response plugin ETAG response header is generated based on attributes that can remain the same even if the file content has been changed.
# Value for the "ETag" header.
def etag
digest = Digest::SHA256.hexdigest("#{file.shrine_class}-#{file.storage_key}-#{file.id}")
%(W/"#{digest.byteslice(0, 32)}")
end
Looks good to me, thanks 👍🏻 I would just rename the keyword argument to :etag, as it communicates better that we're overriding the ETag. Also, would you mind updating the documentation?
The
rack_response
plugin ETAG response header is generated based on attributes that can remain the same even if the file content has been changed.This may result in unwanted response caching.