title: Why would swapping operating systems break ActiveStorage variant URLs?
body: <p>I swapped from Alpine 3.16 to Debian Bullseye slim with jemalloc and somehow this change has broken the redirect based variant URLs for ActiveStorage.</p>
  <p>The method I'm using to generate the URLs is <code>url_for( image.variant(resize_to_limit: [1200, nil]) )</code> and then I embed that URL into a document stored in the DB. This produces a URL that looks like this:</p>
  <pre><code>https://subdomain.example.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdjRDIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--88d725d3131d3979e984fb64b7503ad8dba711c2/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2QzNKbGMybDZaVWtpQ2pFeU1EQStCanNHVkE9PSIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--74294a2119561b1929753c5929e8d0db9fcc9325/Screen%20Shot%202021-06-17%20at%205.41.25%20PM.png
  </code></pre>
  <p>After swapping OS to Debian Bullseye, the old URLs 404. It's a browser default 404 and not a Rails or app custom 404. If I generate the URL with the same method on the same file, it looks like this:</p>
  <pre><code>https://subdomain.example.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdjRDIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3b52e0fc8a157c21903976818d9dd26ddc11debe/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFLd0JEQT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--6b3587a792240d45bcec733c6cf847d3d371b58f/Screen%20Shot%202021-06-17%20at%205.41.25%20PM.png
  </code></pre>
  <p>Any ideas why swapping out the OS would do this?</p>
  <p><strong>Update:</strong></p>
  <p>Upon rolling back to Alpine, the images work again, however the generated URLs are still different. I believe portions of the URL have do to with expiry. So the question isn't why the URLs change but why would an already generated URL become invalid with a new OS? Perhaps there's some hashing going on which changes when a low level library is changed?</p>
  <p>If you base64 decode the hash looking part of the URL part of the decode looks like this:</p>
  <pre><code>{&quot;_rails&quot;:{&quot;message&quot;:&quot;BAh7BzoLZm9ybWF0SSIIcG5nBjoGRVQ6FHJlc2l6ZV90b19saW1pdFsHaQKwBDA=&quot;,&quot;exp&quot;:null,&quot;pur&quot;:&quot;variation&quot;}}
  </code></pre>
  <p>Both URLs have the same json and <code>message</code> - it's the other stuff around it that seems to be causing the difference and the 404.</p>
  <p>The local logs for the 404 look like this:</p>
  <pre><code>Processing by ActiveStorage::Representations::RedirectController#show as */*
    Parameters: {&quot;signed_blob_id&quot;=&gt;&quot;eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBDUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--78168cd86530b23b5c3f81cc8a2818da8a661df9&quot;, &quot;variation_key&quot;=&gt;&quot;eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJU2xCSEJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFLd0JEQT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--54c153007774686020b21201cc609413b0ad9779&quot;, &quot;filename&quot;=&gt;&quot;IMG_6361&quot;}
  Filter chain halted as :set_blob rendered or redirected
  Completed 404 Not Found in 1ms (ActiveRecord: 0.0ms | Allocations: 724)
  </code></pre>