Skip to content

Commit

Permalink
add static asset caching header
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansing committed Jun 28, 2024
1 parent adc249c commit 1244ff1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/iqvoc/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def self.setup_production(config)
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
config.public_file_server.headers = {
'Cache-Control' => "public, s-maxage=#{365.days.to_i}, max-age=#{365.days.to_i}, immutable",
'Expires' => 1.year.from_now.to_formatted_s(:rfc822)
}

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
Expand Down

0 comments on commit 1244ff1

Please sign in to comment.