Rack::SteadyETag
Show archive.org snapshot
is a Rack middleware that generates the same default
ETag
Show archive.org snapshot
for responses that only differ in CSRF tokens or CSP nonces.
By default Rails uses
Rack::ETag
Show archive.org snapshot
to generate ETag
headers by hashing the response body. In theory this would
enable caching
Show archive.org snapshot
for multiple requests to the same resource. However, since most Rails application layouts insert randomly rotating CSRF tokens and CSP nonces into the HTML, two requests for the same content and user will never produce the same response bytes. This means the default ETags from Rails will
never hit a cache
Show archive.org snapshot
.
Rack::SteadyETag
is a drop-in replacement for Rack::ETag
. It excludes random content (like CSRF tokens) from the generated ETag, causing two requests for the same content to usually carry the same ETag.