Posts with the tag caching:

How to set Cache-Control and Expires headers for Paperclip uploads.

In Ruby on Rails applications, gem Paperclip is often used with gem Fog, which has a feature of setting up Cache-Control and Expires headers for file uploads. Assuming, there is the following configuration in config/application.rb file: config.paperclip_defaults = { storage: :fog, fog_credentials: { provider: "Local", local_root: "#{Rails.root}/public" }, fog_directory: "", fog_host: "localhost" } Cache-Control and Expires headers can be set up by adding related attributes to the paperclip configuration: config.paperclip_defaults = { ...previous code... fog_file: { 'Cache-Control' => 'max-age=86400', 'Expires' => 1.week.from_now.httpdate } } Remember that max-age is represented in seconds (so 86400 is 1 day).