title: Rails - How to serve different catalogues of images
body: <p>I would like to serve different catalogues of images depends on actual app configuration. For example: for directory structure like the one below I would like to serve <code>img1.png</code> from <code>folder_1</code> or <code>folder_2</code> for request <code>myapp.com/images/img1.png</code> depends from actual configuration.</p>
  
  <pre><code> - public
     - images
       - folder_1
         - img1.png
       - folder_2
         - img1.png
  </code></pre>
  
  <p>On one application I have used custom middleware, something like this -> <code>config.middleware.use "Rack::MyHandler"</code>. I have given a shot but I have quickly discovered that the request to files in public catalogue is not handled by it. Now the problem lies on that I would like to handle it as fast as possible, so the processing by controller is not the case. Probably running from Apache I would try <code>mod_rewrite</code>, maybe there is something for Rails? Any suggestions? </p>