Say how long a pre-upgrade cached upload can last

Disk URLs are cached for an hour, but blob proxy URLs are cached
publicly and as immutable for a hundred years, so a copy taken that way
before the upgrade doesn't expire.
This commit is contained in:
Jeremy Daer committed 2026-10-15 19:01:12 -07:00
1 parent 562888251e
commit d713f2631d
1 file changed
+7 -4
+7 -4
View File
@@ -6,10 +6,13 @@
# a download, whatever its URL says. Only reads are touched: uploading
# (direct upload JSON, Disk PUT) answers in its own types.
#
# Accepted on upgrade: a browser that cached an upload under a script type
# before this guard shipped can still run it from that cache until the entry
# expires, up to an hour after it was fetched (config/initializers/active_storage.rb).
# Revalidation doesn't help, since a 304 carries no content type.
# Accepted on upgrade: a cache that stored an upload under a script type
# before this guard shipped can still serve it as one until the entry expires.
# For Disk URLs that's up to an hour (config/initializers/active_storage.rb).
# Blob proxy URLs are cached publicly and as immutable for a hundred years
# (Rails' http_cache_forever), so a copy a browser or a shared cache took that
# way doesn't expire. Revalidation doesn't help, since a 304 carries no
# content type.
class UploadedScriptGuard
SERVABLE = %r{\A(image|video|audio)/|\A(application/pdf|application/octet-stream|text/plain)\z}