fix: Add missing Cache-Control headers in the production config (#2518)

This commit is contained in:
Pranav Raj S 2021-06-28 18:32:01 +05:30 committed by GitHub
parent ac657e3bf9
commit b705eb39e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,9 @@ Rails.application.configure do
# Disable serving static files from the `/public` folder by default since # Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this. # Apache or NGINX already handles this.
config.public_file_server.enabled = ActiveModel::Type::Boolean.new.cast(ENV.fetch('RAILS_SERVE_STATIC_FILES', true)) config.public_file_server.enabled = ActiveModel::Type::Boolean.new.cast(ENV.fetch('RAILS_SERVE_STATIC_FILES', true))
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.year.to_i}"
}
# Compress JavaScripts and CSS. # Compress JavaScripts and CSS.
# config.assets.js_compressor = :uglifier # config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass