Accessing ActiveStorage image variants directly

This is my first time with ActiveStorage, so please excuse any misunderstandings! In previous Rails projects I would have used something like the deprecated Paperclip gem to handle image uploads and generation of different size variants of them. These could then be accessed directly by setting up a rule in my front-end server (typically nginx), with a proxy_pass to the Rails application for missing variants which could then be generated on the fly and written to disk, where they would be found by future requests. Is it possible to achieve similar functionality with ActiveStorage?

I understand that the the default behaviour is that URLs for ActiveStorage “blobs” are signed, and the requests are intercepted by AS which redirects to the actual file. This has obvious benefits when dealing with non-public files stored on a cloud service, but I want to store my images on the local disk, so I have disabled the signed URLs by setting public: true in my storage.yml, which seems to get rid of the redirects for previously generated variants, but I still end up with image URLs like

/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJxNzRiZGY2b2Vhd3lyYjFrdG45MnhwMHVhaG9pIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiZDZrbWZjZ2JncG55LmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ2Q2a21mY2diZ3BueS5qcGciLCJjb250ZW50X3R5cGUiOiJpbWFnZS9qcGVnIiwic2VydmljZV9uYW1lIjoibG9jYWwifSwicHVyIjoiYmxvYl9rZXkifX0=--e829f00b29b9d93e05ea82991c2aeeb38670f052/d6kmfcgbgpny.jpg

There are two problems here: firstly, /rails/active_storage/disk/ does not point to a location on the disk, but to an ActiveStorage controller, which makes it impossible to request the image without hitting the Rails application. Secondly, the “key” is a stupendously long Base64 encoded string, which adds significantly to the HTML page size if you have many images. It would also look pretty silly if you wanted to link directly to such a URL.

While I appreciate that a lot of work has gone into ActiveStorage and how useful something like this might be for a large scale social media service with millions of images that need to have complex granular access permissions, but the images on my site are all public, and I have no need for any of it. I love the dynamic variant capabilities, and libvips is truly a salve for the soul after years of being bruised by rmagic, but I feel like I’m trying to hammer in a nail with an F16 fighter jet when a lump of rock would do a better job. Help?

Edit: After some more searching I’ve come up with this:

def image_file_path(image)
  File.join(ActiveStorage::Blob.service.path_for(image.key), image.filename.to_s)
end

which gives me a path like

/var/www/mysite/storage/co/cc/coccyqtpx9hjz8d2fuydq3u2smsq/d6kmfcgbgpny.jpg

But that won’t fly; what I thought was a directory is actually the blob. No file extension. So I should just do

def image_file_path(image)
  ActiveStorage::Blob.service.path_for(image.key)
end

which gives me paths like

/var/www/mysite/storage/co/cc/coccyqtpx9hjz8d2fuydq3u2smsq

Not much use without the file extension though!

I see that CarrierWave is still supported, and updated to work with Rails 7.1 - it even rolls with libvips if you want! I think I might have to switch to that instead; ActiveStorage is apparently not a good fit for the simple stuff I want to do. Shame, because there are many other things I’d rather spend my time on! :unamused:

1 Like

I have now completed the migration from ActiveStorage to CarrierWave and it works well.

  • I can serve images from the front-end server without hitting the Rails application
  • Images have sensible URLs (e.g. public/images/[image_id]/[version]_[filename])
  • The complexity of my image helpers has been significantly reduced
  • I can still make use of libvips, which is a huge leap forward over rmagick/ImageMagick

That said, I’m still interested to hear if there’s a way to coerce ActiveStorage into working the way I want; one of the main objectives of the project I’m working on is to learn all the new & shiny. In this sense switching to CarrierWave does feel like a retrograde step.

As a result of this change, a sample request for a test page with some attached images has changed from

I, [2024-01-23T01:02:32.581451 #14095]  INFO -- : [acc5049a-2087-4b80-9371-64d349b119dd] Started GET "/some-test-page/with-a-gallery" for 11.22.33.44 at 2024-01-23 01:02:32 +0000
I, [2024-01-23T01:02:32.583345 #14095]  INFO -- : [acc5049a-2087-4b80-9371-64d349b119dd] Processing by PagesController#show as HTML
I, [2024-01-23T01:02:32.583845 #14095]  INFO -- : [acc5049a-2087-4b80-9371-64d349b119dd]   Parameters: {"parent_id"=>"some-test-page", "id"=>"with-a-gallery"}
I, [2024-01-23T01:02:32.603752 #14095]  INFO -- : [acc5049a-2087-4b80-9371-64d349b119dd]   Rendered layout layouts/application.html.erb (Duration: 15.6ms | Allocations: 2075)
I, [2024-01-23T01:02:32.604738 #14095]  INFO -- : [acc5049a-2087-4b80-9371-64d349b119dd] Completed 200 OK in 20ms (Views: 15.3ms | ActiveRecord: 2.4ms | Allocations: 2518)
I, [2024-01-23T01:02:32.966156 #14095]  INFO -- : [e31e7f13-5912-4e16-959c-1b36129d4017] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--05da3ed656e88b48eac5cea288f52d90f37d0691/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fZmlsbCI6WzI0MCwyNDBdfSwicHVyIjoidmFyaWF0aW9uIn19--86567abb30482da47ee5d0443acdbb43bbd00688/srgwr42.jpg" for 11.22.33.44 at 2024-01-23 01:02:32 +0000
I, [2024-01-23T01:02:32.968041 #14095]  INFO -- : [e31e7f13-5912-4e16-959c-1b36129d4017] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:32.968460 #14095]  INFO -- : [e31e7f13-5912-4e16-959c-1b36129d4017]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--05da3ed656e88b48eac5cea288f52d90f37d0691", "variation_key"=>"[FILTERED]", "filename"=>"Image four"}
I, [2024-01-23T01:02:32.981412 #14095]  INFO -- : [e31e7f13-5912-4e16-959c-1b36129d4017] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIyczhsM2g1cm1hNDJneTJraDdjNTN2MDNyZmdhIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiZmx5aW5nIGZveC5qcGdcIjsgZmlsZW5hbWUqPVVURi04JydmbHlpbmclMjBmb3guanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6ImxvY2FsIn0sInB1ciI6ImJsb2Jfa2V5In19--0fad74b092f1be3aab9c9479cb4cfe452e438d65/srgwr42.jpg
I, [2024-01-23T01:02:32.982052 #14095]  INFO -- : [e31e7f13-5912-4e16-959c-1b36129d4017] Completed 302 Found in 13ms (ActiveRecord: 2.2ms | Allocations: 1512)
I, [2024-01-23T01:02:33.019419 #14095]  INFO -- : [443d3409-89ae-45ac-b763-70323bd3b619] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MywicHVyIjoiYmxvYl9pZCJ9fQ==--439d07b312caeb8ede331d8179067dc176c76613/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fZmlsbCI6WzI0MCwyNDBdfSwicHVyIjoidmFyaWF0aW9uIn19--86567abb30482da47ee5d0443acdbb43bbd00688/eth435aq.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.021490 #14095]  INFO -- : [443d3409-89ae-45ac-b763-70323bd3b619] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:33.021844 #14095]  INFO -- : [443d3409-89ae-45ac-b763-70323bd3b619]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6MywicHVyIjoiYmxvYl9pZCJ9fQ==--439d07b312caeb8ede331d8179067dc176c76613", "variation_key"=>"[FILTERED]", "filename"=>"Image five"}
I, [2024-01-23T01:02:33.029304 #14095]  INFO -- : [443d3409-89ae-45ac-b763-70323bd3b619] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIyYTZydmJsYW9pYzlzNjFrMHBhcXA3N3locG8xIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiVGhlIFV0YS5qcGdcIjsgZmlsZW5hbWUqPVVURi04JydUaGUlMjBVdGEuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6ImxvY2FsIn0sInB1ciI6ImJsb2Jfa2V5In19--47e1bc8d71ab27734f410ba45045a7f7e8bf4db8/eth435aq.jpg
I, [2024-01-23T01:02:33.029793 #14095]  INFO -- : [443d3409-89ae-45ac-b763-70323bd3b619] Completed 302 Found in 8ms (ActiveRecord: 1.1ms | Allocations: 1404)
I, [2024-01-23T01:02:33.080404 #14095]  INFO -- : [ba23f66c-7c15-40b6-bf3d-8a42ea418b88] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6NSwicHVyIjoiYmxvYl9pZCJ9fQ==--c5e449355f5770a0891030b2fed12d3e387a0fdc/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fZmlsbCI6WzI0MCwyNDBdfSwicHVyIjoidmFyaWF0aW9uIn19--86567abb30482da47ee5d0443acdbb43bbd00688/reh245kk.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.083100 #14095]  INFO -- : [ba23f66c-7c15-40b6-bf3d-8a42ea418b88] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:33.083462 #14095]  INFO -- : [ba23f66c-7c15-40b6-bf3d-8a42ea418b88]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6NSwicHVyIjoiYmxvYl9pZCJ9fQ==--c5e449355f5770a0891030b2fed12d3e387a0fdc", "variation_key"=>"[FILTERED]", "filename"=>"Image three"}
I, [2024-01-23T01:02:33.091572 #14095]  INFO -- : [ba23f66c-7c15-40b6-bf3d-8a42ea418b88] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiI1eXRnMTg1dG1rNndmeGdkOXY2YXB0Z2xiMzU3IiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiVm9pbWEga2l0YXJhdmFodmlzdGluLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ1ZvaW1hJTIwa2l0YXJhdmFodmlzdGluLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--02535884cdb3d47f902a1c7e1a79a89c808e8f7e/reh245kk.jpg
I, [2024-01-23T01:02:33.092070 #14095]  INFO -- : [ba23f66c-7c15-40b6-bf3d-8a42ea418b88] Completed 302 Found in 8ms (ActiveRecord: 1.2ms | Allocations: 1400)
I, [2024-01-23T01:02:33.229748 #14095]  INFO -- : [f04d4414-f1f7-4d20-93a5-962111c06af9] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--adcb92e8f439f6bd2e249ae536d1eed53b3d7412/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fZmlsbCI6WzI0MCwyNDBdfSwicHVyIjoidmFyaWF0aW9uIn19--86567abb30482da47ee5d0443acdbb43bbd00688/th246weth.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.231514 #14095]  INFO -- : [f04d4414-f1f7-4d20-93a5-962111c06af9] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:33.231902 #14095]  INFO -- : [f04d4414-f1f7-4d20-93a5-962111c06af9]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--adcb92e8f439f6bd2e249ae536d1eed53b3d7412", "variation_key"=>"[FILTERED]", "filename"=>"Image one"}
I, [2024-01-23T01:02:33.240185 #14095]  INFO -- : [ca4512a1-287b-4eba-82a6-441527e7e454] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6NDgsInB1ciI6ImJsb2JfaWQifX0=--39ed172eb9ade25b59d3ebd1e9b2e7aa3e4f7d14/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fZmlsbCI6WzI0MCwyNDBdfSwicHVyIjoidmFyaWF0aW9uIn19--86567abb30482da47ee5d0443acdbb43bbd00688/teh4e11.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.241100 #14095]  INFO -- : [ca4512a1-287b-4eba-82a6-441527e7e454] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:33.241180 #14095]  INFO -- : [ca4512a1-287b-4eba-82a6-441527e7e454]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6NDgsInB1ciI6ImJsb2JfaWQifX0=--39ed172eb9ade25b59d3ebd1e9b2e7aa3e4f7d14", "variation_key"=>"[FILTERED]", "filename"=>"Image two"}
I, [2024-01-23T01:02:33.244610 #14095]  INFO -- : [f04d4414-f1f7-4d20-93a5-962111c06af9] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJvZmc1amoyYmFqbHh2bTVianN4eDZ2ZHNxZWR2IiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiRGF2aWQgQm93aWUgYXMgTmlrb2xhIFRlc2xhLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ0RhdmlkJTIwQm93aWUlMjBhcyUyME5pa29sYSUyMFRlc2xhLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--c4c78f2a3c9acda3619354805c82ec7655658f88/th246weth.jpg
I, [2024-01-23T01:02:33.246547 #14095]  INFO -- : [f04d4414-f1f7-4d20-93a5-962111c06af9] Completed 302 Found in 14ms (ActiveRecord: 5.0ms | Allocations: 3769)
I, [2024-01-23T01:02:33.245844 #14095]  INFO -- : [9e69e15d-db4d-4326-b98f-f1f55e05e083] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIyczhsM2g1cm1hNDJneTJraDdjNTN2MDNyZmdhIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiZmx5aW5nIGZveC5qcGdcIjsgZmlsZW5hbWUqPVVURi04JydmbHlpbmclMjBmb3guanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6ImxvY2FsIn0sInB1ciI6ImJsb2Jfa2V5In19--0fad74b092f1be3aab9c9479cb4cfe452e438d65/srgwr42.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.250453 #14095]  INFO -- : [9e69e15d-db4d-4326-b98f-f1f55e05e083] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:33.250622 #14095]  INFO -- : [9e69e15d-db4d-4326-b98f-f1f55e05e083]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image four"}
I, [2024-01-23T01:02:33.251515 #14095]  INFO -- : [9e69e15d-db4d-4326-b98f-f1f55e05e083] Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 115)
I, [2024-01-23T01:02:33.258612 #14095]  INFO -- : [52fb5164-5913-443b-b66e-a46d3735e3d3] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6NDAsInB1ciI6ImJsb2JfaWQifX0=--637d8b182e9962c66d75fc85a4a63ab5cf0d68d4/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fZmlsbCI6WzI0MCwyNDBdfSwicHVyIjoidmFyaWF0aW9uIn19--86567abb30482da47ee5d0443acdbb43bbd00688/aryu278kw.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.261028 #14095]  INFO -- : [52fb5164-5913-443b-b66e-a46d3735e3d3] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:33.263647 #14095]  INFO -- : [52fb5164-5913-443b-b66e-a46d3735e3d3]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6NDAsInB1ciI6ImJsb2JfaWQifX0=--637d8b182e9962c66d75fc85a4a63ab5cf0d68d4", "variation_key"=>"[FILTERED]", "filename"=>"Image six"}
I, [2024-01-23T01:02:33.263211 #14095]  INFO -- : [fbe75e35-885b-49b7-9630-11386492ddd0] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIyYTZydmJsYW9pYzlzNjFrMHBhcXA3N3locG8xIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiVGhlIFV0YS5qcGdcIjsgZmlsZW5hbWUqPVVURi04JydUaGUlMjBVdGEuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6ImxvY2FsIn0sInB1ciI6ImJsb2Jfa2V5In19--47e1bc8d71ab27734f410ba45045a7f7e8bf4db8/eth435aq.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.267315 #14095]  INFO -- : [fbe75e35-885b-49b7-9630-11386492ddd0] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:33.267428 #14095]  INFO -- : [fbe75e35-885b-49b7-9630-11386492ddd0]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image five"}
I, [2024-01-23T01:02:33.268754 #14095]  INFO -- : [fbe75e35-885b-49b7-9630-11386492ddd0] Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 100)
I, [2024-01-23T01:02:33.290788 #14095]  INFO -- : [52fb5164-5913-443b-b66e-a46d3735e3d3] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJ1czllN2l0cGhpYjYyaWpyeTk1dDcyNTM5djdnIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwidG9vbF9ib3hfY29udGVudHMuanBnXCI7IGZpbGVuYW1lKj1VVEYtOCcndG9vbF9ib3hfY29udGVudHMuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6ImxvY2FsIn0sInB1ciI6ImJsb2Jfa2V5In19--b34246fa66887ed0e786ad0977c26012f092943e/aryu278kw.jpg
I, [2024-01-23T01:02:33.294291 #14095]  INFO -- : [52fb5164-5913-443b-b66e-a46d3735e3d3] Completed 302 Found in 30ms (ActiveRecord: 10.2ms | Allocations: 3704)
I, [2024-01-23T01:02:33.308286 #14095]  INFO -- : [ca4512a1-287b-4eba-82a6-441527e7e454] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIzZmVucm5sZXBsNXFsZzJ6MXQyYWs0MXN0ZDBrIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwic29ubWktNDUxLWFuZC1oYWUtam9vLWNoYW5nLXNjYWxpbmctbmVvLXNvdWwtMjE0NC1jbG91ZC1hdGxhcy5qcGdcIjsgZmlsZW5hbWUqPVVURi04Jydzb25taS00NTEtYW5kLWhhZS1qb28tY2hhbmctc2NhbGluZy1uZW8tc291bC0yMTQ0LWNsb3VkLWF0bGFzLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--d6d3bed24a8992c99c25bd9781534e4402ec2b7c/teh4e11.jpg
I, [2024-01-23T01:02:33.308904 #14095]  INFO -- : [ca4512a1-287b-4eba-82a6-441527e7e454] Completed 302 Found in 68ms (ActiveRecord: 21.7ms | Allocations: 9085)
I, [2024-01-23T01:02:33.340576 #14095]  INFO -- : [a661929b-03db-48c0-ab01-c0aab9f803cd] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiI1eXRnMTg1dG1rNndmeGdkOXY2YXB0Z2xiMzU3IiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiVm9pbWEga2l0YXJhdmFodmlzdGluLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ1ZvaW1hJTIwa2l0YXJhdmFodmlzdGluLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--02535884cdb3d47f902a1c7e1a79a89c808e8f7e/reh245kk.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.342756 #14095]  INFO -- : [a661929b-03db-48c0-ab01-c0aab9f803cd] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:33.343213 #14095]  INFO -- : [a661929b-03db-48c0-ab01-c0aab9f803cd]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image three"}
I, [2024-01-23T01:02:33.345566 #14095]  INFO -- : [a661929b-03db-48c0-ab01-c0aab9f803cd] Completed 200 OK in 2ms (ActiveRecord: 0.0ms | Allocations: 100)
I, [2024-01-23T01:02:33.380724 #14095]  INFO -- : [64bd47fe-f930-49dd-8ffe-8c00d7ee332d] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJvZmc1amoyYmFqbHh2bTVianN4eDZ2ZHNxZWR2IiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiRGF2aWQgQm93aWUgYXMgTmlrb2xhIFRlc2xhLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ0RhdmlkJTIwQm93aWUlMjBhcyUyME5pa29sYSUyMFRlc2xhLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--c4c78f2a3c9acda3619354805c82ec7655658f88/th246weth.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.383258 #14095]  INFO -- : [64bd47fe-f930-49dd-8ffe-8c00d7ee332d] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:33.383760 #14095]  INFO -- : [64bd47fe-f930-49dd-8ffe-8c00d7ee332d]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image one"}
I, [2024-01-23T01:02:33.385091 #14095]  INFO -- : [64bd47fe-f930-49dd-8ffe-8c00d7ee332d] Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 100)
I, [2024-01-23T01:02:33.399310 #14095]  INFO -- : [347135f6-467f-42d2-a4fd-4be580b53c2a] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJ1czllN2l0cGhpYjYyaWpyeTk1dDcyNTM5djdnIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwidG9vbF9ib3hfY29udGVudHMuanBnXCI7IGZpbGVuYW1lKj1VVEYtOCcndG9vbF9ib3hfY29udGVudHMuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6ImxvY2FsIn0sInB1ciI6ImJsb2Jfa2V5In19--b34246fa66887ed0e786ad0977c26012f092943e/aryu278kw.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.401060 #14095]  INFO -- : [347135f6-467f-42d2-a4fd-4be580b53c2a] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:33.401440 #14095]  INFO -- : [347135f6-467f-42d2-a4fd-4be580b53c2a]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image six"}
I, [2024-01-23T01:02:33.403083 #14095]  INFO -- : [347135f6-467f-42d2-a4fd-4be580b53c2a] Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 105)
I, [2024-01-23T01:02:33.406561 #14095]  INFO -- : [e593313b-4784-4770-b5ea-a595f8d4453d] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIzZmVucm5sZXBsNXFsZzJ6MXQyYWs0MXN0ZDBrIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwic29ubWktNDUxLWFuZC1oYWUtam9vLWNoYW5nLXNjYWxpbmctbmVvLXNvdWwtMjE0NC1jbG91ZC1hdGxhcy5qcGdcIjsgZmlsZW5hbWUqPVVURi04Jydzb25taS00NTEtYW5kLWhhZS1qb28tY2hhbmctc2NhbGluZy1uZW8tc291bC0yMTQ0LWNsb3VkLWF0bGFzLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--d6d3bed24a8992c99c25bd9781534e4402ec2b7c/teh4e11.jpg" for 11.22.33.44 at 2024-01-23 01:02:33 +0000
I, [2024-01-23T01:02:33.408124 #14095]  INFO -- : [e593313b-4784-4770-b5ea-a595f8d4453d] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:33.408495 #14095]  INFO -- : [e593313b-4784-4770-b5ea-a595f8d4453d]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image two"}
I, [2024-01-23T01:02:33.409600 #14095]  INFO -- : [e593313b-4784-4770-b5ea-a595f8d4453d] Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 100)
I, [2024-01-23T01:02:50.781097 #14095]  INFO -- : [b06439ef-f76d-45ff-b1a4-acc4eb529651] Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--adcb92e8f439f6bd2e249ae536d1eed53b3d7412/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fbGltaXQiOls4MDAsbnVsbF19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--3905df33c60c9b59e67981057f740ad6a98bfa8a/th246weth.jpg" for 11.22.33.44 at 2024-01-23 01:02:50 +0000
I, [2024-01-23T01:02:50.783078 #14095]  INFO -- : [b06439ef-f76d-45ff-b1a4-acc4eb529651] Processing by ActiveStorage::Representations::RedirectController#show as JPEG
I, [2024-01-23T01:02:50.783449 #14095]  INFO -- : [b06439ef-f76d-45ff-b1a4-acc4eb529651]   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--adcb92e8f439f6bd2e249ae536d1eed53b3d7412", "variation_key"=>"[FILTERED]", "filename"=>"Image one"}
I, [2024-01-23T01:02:50.791832 #14095]  INFO -- : [b06439ef-f76d-45ff-b1a4-acc4eb529651] Redirected to https://my.dev.server/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiI3ZTQwbm5jeXE2cWgyZDBybnduanFodGc0bGJsIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiRGF2aWQgQm93aWUgYXMgTmlrb2xhIFRlc2xhLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ0RhdmlkJTIwQm93aWUlMjBhcyUyME5pa29sYSUyMFRlc2xhLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--030f0b083edd93e839fc02d6a9138f57352465ca/th246weth.jpg
I, [2024-01-23T01:02:50.792511 #14095]  INFO -- : [b06439ef-f76d-45ff-b1a4-acc4eb529651] Completed 302 Found in 9ms (ActiveRecord: 1.2ms | Allocations: 1430)
I, [2024-01-23T01:02:50.900197 #14095]  INFO -- : [9af11ec5-5033-41b9-a6a5-22492cd8f488] Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiI3ZTQwbm5jeXE2cWgyZDBybnduanFodGc0bGJsIiwiZGlzcG9zaXRpb24iOiJpbmxpbmU7IGZpbGVuYW1lPVwiRGF2aWQgQm93aWUgYXMgTmlrb2xhIFRlc2xhLmpwZ1wiOyBmaWxlbmFtZSo9VVRGLTgnJ0RhdmlkJTIwQm93aWUlMjBhcyUyME5pa29sYSUyMFRlc2xhLmpwZyIsImNvbnRlbnRfdHlwZSI6ImltYWdlL2pwZWciLCJzZXJ2aWNlX25hbWUiOiJsb2NhbCJ9LCJwdXIiOiJibG9iX2tleSJ9fQ==--030f0b083edd93e839fc02d6a9138f57352465ca/th246weth.jpg" for 11.22.33.44 at 2024-01-23 01:02:50 +0000
I, [2024-01-23T01:02:50.902535 #14095]  INFO -- : [9af11ec5-5033-41b9-a6a5-22492cd8f488] Processing by ActiveStorage::DiskController#show as JPEG
I, [2024-01-23T01:02:50.902992 #14095]  INFO -- : [9af11ec5-5033-41b9-a6a5-22492cd8f488]   Parameters: {"encoded_key"=>"[FILTERED]", "filename"=>"Image one"}
I, [2024-01-23T01:02:50.904182 #14095]  INFO -- : [9af11ec5-5033-41b9-a6a5-22492cd8f488] Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 100)

to just

I, [2024-01-23T13:04:29.013971 #19524]  INFO -- : [97d315ef-614a-42a6-9f65-588492fdbfdc] Started GET "some-test-page/with-a-gallery" for 46.43.9.114 at 2024-01-23 13:04:29 +0000
I, [2024-01-23T13:04:29.015662 #19524]  INFO -- : [97d315ef-614a-42a6-9f65-588492fdbfdc] Processing by PagesController#show as HTML
I, [2024-01-23T13:04:29.016264 #19524]  INFO -- : [97d315ef-614a-42a6-9f65-588492fdbfdc]   Parameters: {"parent_id"=>"some-test-page", "id"=>"with-a-gallery"}
I, [2024-01-23T13:04:29.027178 #19524]  INFO -- : [97d315ef-614a-42a6-9f65-588492fdbfdc]   Rendered layout layouts/application.html.erb (Duration: 7.0ms | Allocations: 1248)
I, [2024-01-23T13:04:29.028469 #19524]  INFO -- : [97d315ef-614a-42a6-9f65-588492fdbfdc] Completed 200 OK in 12ms (Views: 7.9ms | ActiveRecord: 1.3ms | Allocations: 1707)

That’s 18.6 kB vs. 813 bytes. If nothing else it’ll reduce log file growth! :joy:

1 Like