“Expires headers tell the browser whether they should request a specific file from the server or whether they should grab it from the browser’s cache.” gtmetrix.com
Add Rack Deflater To config.ru and Change Your config.ru From This :[code language=”ruby”] # This file is used by Rack-based servers to start the application. require ::File.expandpath(‘../config/environment’, _FILE) run AppName::Application [/code]
Into this :[code language=”ruby”] # This file is used by Rack-based servers to start the application. require ::File.expandpath(‘../config/environment’, _FILE) use Rack::Deflater run AppName::Application [/code]
Configure Your production.rb File Make Sure You Add or Uncomment This Config in Your production.rb File :[code language=”ruby”] config.serve_static_assets = true config.static_cache_control = “public, max-age=31536000” [/code]
You Can Use Your Browser Developer Tool to See That Your Assets Already Added Expires Header or Not.
Mostly expires header used on static image asset, but they can and should be used on all page components including scripts, style sheets and flash.