Whenever a first-time visitor visits your page, it may take several HTTP requests before the web page finish loading. To speed up your website, it helps to use Expires header to make any web page components cachaeble. By doing this, you can avoid any unnecessary HTTP requests on subsequent page views. Expires headers are most often used with images but it is still highly recommended that they also be used on ALL components such scripts, stylesheets, and Flash as well.
So here’s a nice short snippet from Mohit Jain that lets you add expires headers to assets in Ruby on Rails:
config.static_cache_control = "public, max-age=31536000" # in production.rb file
And in your config.ru file:
require ::File.expand_path('../config/environment', __FILE__) use Rack::Deflater run YourApplicationName::Application
Actually, there are many ways to do this but this one in particular can be very helpful, especially in cases where you want to add expiry headers to assets hosted on Heroku.
(Image credit for parking meter: HerCampus.com)